@tokens = @user.oauth_tokens.find :all, :conditions => 'oauth_tokens.invalidated_at is null and oauth_tokens.authorized_at is not null'
if params[:user] and params[:user][:display_name] and params[:user][:description]
- if params[:user][:email] != @user.email
- @user.new_email = params[:user][:email]
- end
-
@user.display_name = params[:user][:display_name]
+ @user.new_email = params[:user][:new_email]
if params[:user][:pass_crypt].length > 0 or params[:user][:pass_crypt_confirmation].length > 0
@user.pass_crypt = params[:user][:pass_crypt]
if @user.save
set_locale
- if params[:user][:email] == @user.new_email
+ if @user.new_email.nil? or @user.new_email.empty?
+ flash.now[:notice] = t 'user.account.flash update success'
+ else
flash.now[:notice] = t 'user.account.flash update success confirm needed'
Notifier.deliver_email_confirm(@user, @user.tokens.create)
- else
- flash.now[:notice] = t 'user.account.flash update success'
end
end
else
if flash[:errors]
flash[:errors].each do |attr,msg|
+ attr = "new_email" if attr == "email"
@user.errors.add(attr,msg)
end
end
-
- @user.email = @user.new_email if @user.new_email
end
end
<% form_for :user, @user do |f| %>
<table id="accountForm">
<tr><td class="fieldName"><%= t 'user.new.display name' %></td><td><%= f.text_field :display_name %></td></tr>
- <tr><td class="fieldName"><%= t 'user.new.email address' %></td><td><%= f.text_field :email, {:size => 50, :maxlength => 255} %> <span class="minorNote"><%= t 'user.account.email never displayed publicly' %></span></td></tr>
+ <tr><td class="fieldName" style="padding-bottom:0px;"><%= t 'user.account.current email address' %></td><td style="padding-bottom:0px;"><%= @user.email %> <span class="minorNote"><%= t 'user.account.email never displayed publicly' %></span></td></tr>
+ <tr><td class="fieldName"><%= t 'user.account.new email address' %></td><td><%= f.text_field :new_email, {:size => 50, :maxlength => 255} %> <span class="minorNote"><%= t 'user.account.email never displayed publicly' %></span></td></tr>
<tr><td class="fieldName" style="padding-bottom:0px;"><%= t 'user.new.password' %></td><td style="padding-bottom:0px;"><%= f.password_field :pass_crypt, {:value => '', :size => 30, :maxlength => 255} %></td></tr>
<tr><td class="fieldName"><%= t 'user.new.confirm password' %></td><td><%= f.password_field :pass_crypt_confirmation, {:value => '', :size => 30, :maxlength => 255} %></td></tr>
account:
title: "Edit account"
my settings: My settings
+ current email address: "Current Email Address:"
+ new email address: "New Email Address:"
email never displayed publicly: "(never displayed publicly)"
public editing:
heading: "Public editing:"