From: Tom Hughes Date: Fri, 10 Jun 2011 18:11:08 +0000 (+0100) Subject: Merge branch 'master' into openid X-Git-Tag: live~6275 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/ce7b651eb25473b74765ccb349f37ebd4ea6edfe Merge branch 'master' into openid --- ce7b651eb25473b74765ccb349f37ebd4ea6edfe diff --cc app/models/user.rb index 79af5d71f,a817c0fcf..0b2a902df --- a/app/models/user.rb +++ b/app/models/user.rb @@@ -23,14 -23,13 +23,14 @@@ class User < ActiveRecord::Bas validates_confirmation_of :pass_crypt#, :message => ' must match the confirmation password' validates_uniqueness_of :display_name, :allow_nil => true validates_uniqueness_of :email + validates_uniqueness_of :openid_url, :allow_nil => true validates_length_of :pass_crypt, :within => 8..255 validates_length_of :display_name, :within => 3..255, :allow_nil => true - validates_email_format_of :email - validates_email_format_of :new_email, :allow_blank => true - validates_format_of :display_name, :with => /^[^\/;.,?]*$/ - validates_format_of :display_name, :with => /^\S/, :message => "has leading whitespace" - validates_format_of :display_name, :with => /\S$/, :message => "has trailing whitespace" + validates_email_format_of :email, :if => Proc.new { |u| u.email_changed? } + validates_email_format_of :new_email, :allow_blank => true, :if => Proc.new { |u| u.new_email_changed? } + validates_format_of :display_name, :with => /^[^\/;.,?]*$/, :if => Proc.new { |u| u.display_name_changed? } + validates_format_of :display_name, :with => /^\S/, :message => "has leading whitespace", :if => Proc.new { |u| u.display_name_changed? } + validates_format_of :display_name, :with => /\S$/, :message => "has trailing whitespace", :if => Proc.new { |u| u.display_name_changed? } validates_numericality_of :home_lat, :allow_nil => true validates_numericality_of :home_lon, :allow_nil => true validates_numericality_of :home_zoom, :only_integer => true, :allow_nil => true diff --cc app/views/user/login.html.erb index 0616d76f8,8fe094cfa..6297b219d --- a/app/views/user/login.html.erb +++ b/app/views/user/login.html.erb @@@ -3,13 -2,12 +3,13 @@@

<%= t 'user.login.heading' %>

-

<%= t 'user.login.already have' %>

- - <% form_tag :action => 'login' do %> + <% form_tag({ :action => "login" }, { :id => "login_form" }) do %> <%= hidden_field_tag('referer', h(params[:referer])) %> + +

<%= t 'user.login.with username' %>

+ - +
<%= t 'user.login.email or username' %><%= text_field('user', 'email',{:value => "", :size => 28, :maxlength => 255, :tabindex => 1}) %>
<%= t 'user.login.email or username' %><%= text_field('user', 'email',{:value => params[:username], :size => 28, :maxlength => 255, :tabindex => 1}) %>
<%= t 'user.login.password' %><%= password_field('user', 'password',{:value => "", :size => 28, :maxlength => 255, :tabindex => 2}) %> (<%= link_to t('user.login.lost password link'), :controller => 'user', :action => 'lost_password' %>)
<%= check_box_tag "remember_me", "yes", false, :tabindex => 3 %>