From 4d1d45d70e4d2516d3082a97ff9bf255c70da307 Mon Sep 17 00:00:00 2001 From: albert Date: Thu, 15 Sep 2011 18:02:00 -0400 Subject: [PATCH] fixes #48: Adding email via profile --- app/controllers/users_controller.rb | 5 +- app/views/users/_secondary_links.html.erb | 1 - app/views/users/new.html.erb | 102 +++++++++++----------- 3 files changed, 56 insertions(+), 52 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 1f5788a4e..2ab60a448 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -28,8 +28,9 @@ class UsersController < ApplicationController def create @user = User.create(params[:user]) - flash[:notice] = "There were errors" if @user.errors.any? - session[:user_id] = @user.id + if @user.errors.empty? + session[:user_id] = @user.id + end set_current_user respond_with(@user) end diff --git a/app/views/users/_secondary_links.html.erb b/app/views/users/_secondary_links.html.erb index 11f8cab7b..9ef03f038 100644 --- a/app/views/users/_secondary_links.html.erb +++ b/app/views/users/_secondary_links.html.erb @@ -1,7 +1,6 @@ <% content_for(:secondary_links) do %>
  • <%= link_to "Listing", users_path %>
  • -
  • <%= link_to "Signup", new_user_path %>
  • <% if @user && !@user.new_record? %>
  • |
  • <%= link_to "Edit", edit_user_path(@user) %>
  • diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 0792b4ad0..9c3379793 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -2,64 +2,68 @@

    Signup

    -
    -

    <%= Danbooru.config.app_name %> is ad-sponsored and does not require an account to view. But in order to start uploading, editing, or creating content on this site, you will need to register. Make sure you read and agree to the <%= link_to "terms of service", terms_of_service_path %> before registering. This site is open to web crawlers, therefore any name you choose will be public!

    + <% if @user.errors.empty? %> +
    +

    <%= Danbooru.config.app_name %> is ad-sponsored and does not require an account to view. But in order to start uploading, editing, or creating content on this site, you will need to register. Make sure you read and agree to the <%= link_to "terms of service", terms_of_service_path %> before registering. This site is open to web crawlers, therefore any name you choose will be public!

    -

    Registration for a basic account is free but comes with some limitations.

    +

    Registration for a basic account is free but comes with some limitations.

    -
    -
    -

    Basic

    -
      -
    • Free
    • -
    • Uploads limited
    • -
    • Search up to 2 tags at once
    • -
    • Some hidden posts
    • -
    • Ads visible
    • -
    • Create and edit posts, favorites, forum posts, comments, wiki pages, pools, artists, and dmails
    • -
    -
    +
    +
    +

    Basic

    +
      +
    • Free
    • +
    • Uploads limited
    • +
    • Search up to 2 tags at once
    • +
    • Some hidden posts
    • +
    • Ads visible
    • +
    • Create and edit posts, favorites, forum posts, comments, wiki pages, pools, artists, and dmails
    • +
    +
    -
    -

    Privileged

    -
      -
    • One time $20 fee
    • -
    • Uploads limited
    • -
    • Search up to 6 tags at once
    • -
    • No hidden posts
    • -
    • No ads
    • -
    • Tag subscriptions
    • -
    -
    +
    +

    Privileged

    +
      +
    • One time $20 fee
    • +
    • Uploads limited
    • +
    • Search up to 6 tags at once
    • +
    • No hidden posts
    • +
    • No ads
    • +
    • Tag subscriptions
    • +
    +
    -
    -

    Contributor

    -
      -
    • Invitation only
    • -
    • No upload limits
    • -
    -
    +
    +

    Contributor

    +
      +
    • Invitation only
    • +
    • No upload limits
    • +
    +
    -
    +
    +
    -
    -
    -

    There are some restrictions on names:

    +
    +

    There are some restrictions on names:

    -
      -
    • Name: Your name must be at least 2 characters and at most 20 characters long. It cannot contain spaces or colons. All characters must be US-ASCII.
    • -
    • Password: Your password must be at least 5 characters long.
    • -
    • - Email: - <% if Danbooru.config.enable_email_verification? %> - You must enter a valid email address. You will need to verify your email address after registering. - <% else %> - You can optionally enter an email address. Although optional, you will not be able to reset your password without an email address. - <% end %> -
    • -
    +
      +
    • Name: Your name must be at least 2 characters and at most 20 characters long. It cannot contain spaces or colons. All characters must be US-ASCII.
    • +
    • Password: Your password must be at least 5 characters long.
    • +
    • + Email: + <% if Danbooru.config.enable_email_verification? %> + You must enter a valid email address. You will need to verify your email address after registering. + <% else %> + You can optionally enter an email address. Although optional, you will not be able to reset your password without an email address. + <% end %> +
    • +
    +
    + <% end %> +
    <%= simple_form_for(@user) do |f| %> <%= f.input :name %> <%= f.input :password %>