diff options
author | francis <francis> | 2007-11-06 18:09:36 +0000 |
---|---|---|
committer | francis <francis> | 2007-11-06 18:09:36 +0000 |
commit | 2e68d48c175a218ea819f0ef4c7e8c5a1baf02cf (patch) | |
tree | b9ca414a96422d320f21f621231cd7f4c71a99e9 | |
parent | b8690d35a212192cb18a1fe5d25d75d860a5942e (diff) |
Put sign in and sign up forms on same page initially
-rw-r--r-- | app/controllers/user_controller.rb | 23 | ||||
-rw-r--r-- | app/views/user/_signin.rhtml | 30 | ||||
-rw-r--r-- | app/views/user/_signup.rhtml | 44 | ||||
-rw-r--r-- | app/views/user/sign.rhtml | 12 | ||||
-rw-r--r-- | app/views/user/signin.rhtml | 29 | ||||
-rw-r--r-- | app/views/user/signup.rhtml | 49 | ||||
-rw-r--r-- | public/stylesheets/main.css | 39 | ||||
-rw-r--r-- | todo.txt | 3 |
8 files changed, 136 insertions, 93 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index d490fae07..95f44e40f 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: user_controller.rb,v 1.12 2007-11-06 15:50:58 francis Exp $ +# $Id: user_controller.rb,v 1.13 2007-11-06 18:09:36 francis Exp $ class UserController < ApplicationController # XXX See controllers/application.rb simplify_url_part for reverse of expression in SQL below @@ -30,7 +30,7 @@ class UserController < ApplicationController if not params[:user] # First time page is shown - render :action => 'signin' + render :action => 'sign' return else @user = User.authenticate(params[:user][:email], params[:user][:password]) @@ -44,18 +44,11 @@ class UserController < ApplicationController end return else - if User.find(:first, :conditions => [ "email ilike ?", params[:user][:email] ]) # using like for case insensitive - # Failed to authenticate - flash[:error] = "Password not correct, please try again" - @user = User.new(params[:user]) - render :action => 'signin' - return - else - # Create a new account - params[:first_time] = true - self.signup - return - end + # Failed to authenticate + flash[:error] = "Email or password not correct, please try again" + @user = User.new(params[:user]) + render :action => 'signin' + return end end end @@ -69,7 +62,7 @@ class UserController < ApplicationController @first_time = params[:first_time] @user.errors.clear if @first_time # Show the form - render :action => 'signup' + render :action => (@first_time ? 'sign' : 'signup') else # New unconfirmed user @user.email_confirmed = false diff --git a/app/views/user/_signin.rhtml b/app/views/user/_signin.rhtml new file mode 100644 index 000000000..470c7709c --- /dev/null +++ b/app/views/user/_signin.rhtml @@ -0,0 +1,30 @@ +<div id="signin"> + +<% form_tag({:action => "signin"}, {:id => "accountForm"}) do %> + <%= foi_error_messages_for :user %> + + <% if not flash[:error] %> + <h2>If you've used GovernmentSpy before</h2> + <% end %> + + <p> + <label for="user_email" id="signin_email"><strong>Your e-mail:</strong></label> + <%= text_field 'user', 'email', { :size => 20 } %> + </p> + + <p> + <label for="user_password"><strong>Password:</strong></label> + <%= password_field 'user', 'password', { :size => 15 } %> + </p> + + <p class="form_note"> + Forgotten your password? Tough. + </p> + + <div class="form_button"> + <%= hidden_field_tag 'token', params[:token] %> + <%= submit_tag "Sign in" %> + </div> +<% end %> + +</div> diff --git a/app/views/user/_signup.rhtml b/app/views/user/_signup.rhtml new file mode 100644 index 000000000..fb13f9b48 --- /dev/null +++ b/app/views/user/_signup.rhtml @@ -0,0 +1,44 @@ +<div id="signup"> + +<% form_tag({:action => "signup"}, {:id => "accountForm"}) do %> + <%= foi_error_messages_for :user %> + + <% if not flash[:error] %> + <h2>If you're new to GovernmentSpy</h2> + <% end %> + + <p> + <label for="user_email" id="signin_email"><strong>Your e-mail:</strong></label> + <%= text_field 'user', 'email', :size => 20 %> + </p> + <div class="form_item_note"> + We will not reveal your email address to anybody. + </div> + + <p> + <label for="name"><strong>Your name:</strong></label> + <%= text_field 'user', 'name', { :size => 20 } %> + </p> + <div class="form_item_note">Your <strong>name will appear + publically</strong> on this website and in search engines. We encourage you + to use your real name, but you may use a pseudonym if you would like to be + anonymous.</div> + + <p> + <label for="password"><strong>Password:</strong></label> + <%= password_field 'user', 'password', { :size => 15 } %> + </p> + + <p> + <label for="password"><strong>Password: (again)</strong></label> + <%= password_field 'user', 'password_confirmation', { :size => 15 } %> + </p> + + <div class="form_button"> + <%= hidden_field_tag 'token', params[:token] %> + <%= submit_tag "Sign up" %> + </div> + +<% end %> + +</div> diff --git a/app/views/user/sign.rhtml b/app/views/user/sign.rhtml new file mode 100644 index 000000000..a2ff6ab19 --- /dev/null +++ b/app/views/user/sign.rhtml @@ -0,0 +1,12 @@ +<div id="sign_together"> + +<p id="sign_in_reason"> +<%= @post_redirect.reason_params[:web] %> +</p> + +<%= render :partial => 'signin' %> + +<%= render :partial => 'signup' %> + +</div> + diff --git a/app/views/user/signin.rhtml b/app/views/user/signin.rhtml index 401565bde..3dcfd198f 100644 --- a/app/views/user/signin.rhtml +++ b/app/views/user/signin.rhtml @@ -1,28 +1 @@ -<%= foi_error_messages_for :user %> - -<% form_tag({:action => "signin"}, {:id => "accountForm"}) do %> - <% if not @post_redirect.reason_params[:web].nil? %> - <div class="form_note"><%= @post_redirect.reason_params[:web] %></div> - <% end %> - - <p> - <label for="user_email" id="signin_email"><strong>Enter your e-mail address:</strong></label> - <%= text_field 'user', 'email', { :size => 20 } %> - </p> - - <p> - <label for="user_password"><strong>Password:</strong></label> - <%= password_field 'user', 'password', { :size => 15 } %> - </p> - - <p class="form_note"> - Don't have a password? Just enter one to create a new account. - </p> - - <div class="form_button"> - <%= hidden_field_tag 'token', params[:token] %> - <%= submit_tag "Sign in" %> - </div> - -<% end %> - +<%= render :partial => 'signin' %> diff --git a/app/views/user/signup.rhtml b/app/views/user/signup.rhtml index fd83174b6..bcade0078 100644 --- a/app/views/user/signup.rhtml +++ b/app/views/user/signup.rhtml @@ -1,48 +1 @@ -<%= foi_error_messages_for :user %> - -<% form_tag({:action => "signup"}, {:id => "accountForm"}) do %> - <% if @first_time %> - <div class="form_note"> - <h1>Register new account</h1> - </div> - <% end %> - - <p> - <label for="user_email" id="signin_email"><strong>E-mail:</strong></label> - <%= text_field 'user', 'email', :size => 20 %> - </p> - - <p> - <label for="name"><strong>Full name:</strong> e.g. "Jack Bauer"</label> - <%= text_field 'user', 'name', { :size => 20 } %> - </p> - - <p> - <label for="password"><strong>Password:</strong></label> - <%= password_field 'user', 'password', { :size => 15 } %> - </p> - - <p> - <label for="password"><strong>Password (again):</strong></label> - <%= password_field 'user', 'password_confirmation', { :size => 15 } %> - </p> - - <div class="form_note"> - <strong>Privacy notes</strong> - <ul> - <li>We will not reveal your email address to anybody. - <li>Your <strong>name will appear publically</strong> on this website and - in search engines. We encourage you to use your real name, but you may use - an obvious pseudonym if you would like to be anonymous. - <li>Any requests you make using the same email will be displayed on the - site under the same name. - </ul> - </div> - - <div class="form_button"> - <%= hidden_field_tag 'token', params[:token] %> - <%= submit_tag "Sign up" %> - </div> - -<% end %> - +<%= render :partial => 'signup' %> diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css index 8cc0c23b4..f7c08caa7 100644 --- a/public/stylesheets/main.css +++ b/public/stylesheets/main.css @@ -140,18 +140,26 @@ select, input, textarea { } label { + clear: both; float: left; text-align: right; padding-right: 0.5em; - width: 16em; margin-bottom: 0.5em; } +label { + width: 16em; +} .form_note { margin-left: 16.5em; } .form_button { margin-left: 16em; } +.form_item_note { + margin-left: 16.5em; + margin-top: -0.85em; + font-style: italic; +} /* Flashes */ @@ -239,7 +247,6 @@ table#list_requests .odd { /* User accounts */ #accountForm { - width: 75%; } .confirmation_message { @@ -251,6 +258,34 @@ table#list_requests .odd { text-align: center; } +#sign_together #signin { + width: 48%; + float: left; +} + +#sign_together #signup { + width: 48%; + float: right; +} + +#sign_together label { + width: 8em; +} +#sign_together .form_note { + margin-left: 8.5em; +} +#sign_together .form_button { + margin-left: 8em; +} +#sign_together .form_item_note { + margin-left: 8.5em; +} + +#sign_in_reason { + font-weight: bold; + text-align: center; + font-size: 125%; +} /* Speech bubbles * from http://www.cssplay.co.uk/boxes/chunky.html */ @@ -7,6 +7,7 @@ Next Send email to requestor telling them new information has come in Forgotten password link +Email has already been taken Make it say "dear" as default letter @@ -31,6 +32,8 @@ Make login have wording like on PledgeBank What if I don't receive the email? +Use word verify + Tidying ======= |