Display the current email address and any pending new email address
separately on the user settings page.
This commit is contained in:
parent
d907b40eab
commit
846699104d
3 changed files with 9 additions and 10 deletions
|
@ -47,11 +47,8 @@ class UserController < ApplicationController
|
|||
@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]
|
||||
|
@ -66,21 +63,20 @@ class UserController < ApplicationController
|
|||
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
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<% 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>
|
||||
|
||||
|
|
|
@ -1449,6 +1449,8 @@ en:
|
|||
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:"
|
||||
|
|
Loading…
Add table
Reference in a new issue