Require current password on password change - merged with i18n
This commit is contained in:
parent
6b20a3a913
commit
a823a31688
|
@ -67,9 +67,14 @@ class SettingsController < ApplicationController
|
||||||
def update
|
def update
|
||||||
@edit_user = @user.clone
|
@edit_user = @user.clone
|
||||||
|
|
||||||
if @edit_user.update_attributes(user_params)
|
if params[:user][:password].empty? ||
|
||||||
flash.now[:success] = t('.updatesettingsflash')
|
@user.authenticate(params[:current_password].to_s)
|
||||||
@user = @edit_user
|
if @edit_user.update_attributes(user_params)
|
||||||
|
flash.now[:success] = t('.updatesettingsflash')
|
||||||
|
@user = @edit_user
|
||||||
|
end
|
||||||
|
else
|
||||||
|
flash[:error] = t('.passwordnotcorrect')
|
||||||
end
|
end
|
||||||
|
|
||||||
render :action => "index"
|
render :action => "index"
|
||||||
|
|
|
@ -18,6 +18,12 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="boxline">
|
||||||
|
<%= label_tag :current_password, t('.currentpassword'),
|
||||||
|
:class => "required" %>
|
||||||
|
<%= password_field_tag :current_password, nil, :size => 40 %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="boxline">
|
<div class="boxline">
|
||||||
<%= f.label :password, t('.password'), :class => "required" %>
|
<%= f.label :password, t('.password'), :class => "required" %>
|
||||||
<%= f.password_field :password, :size => 40, :autocomplete => "off" %>
|
<%= f.password_field :password, :size => 40, :autocomplete => "off" %>
|
||||||
|
|
|
@ -250,6 +250,7 @@ en:
|
||||||
accountsettings: "Account Settings"
|
accountsettings: "Account Settings"
|
||||||
username: "Username:"
|
username: "Username:"
|
||||||
password: "New Password:"
|
password: "New Password:"
|
||||||
|
currentpassword: "Current Password:"
|
||||||
confirmpassword: "Confirm Password:"
|
confirmpassword: "Confirm Password:"
|
||||||
emailaddress: "E-mail Address:"
|
emailaddress: "E-mail Address:"
|
||||||
gravatarized: "<a href=\"http://www.gravatar.com/\" target=\"_blank\">Gravatar</a>'ized"
|
gravatarized: "<a href=\"http://www.gravatar.com/\" target=\"_blank\">Gravatar</a>'ized"
|
||||||
|
@ -328,6 +329,7 @@ en:
|
||||||
verifyenable: "Verify and Enable"
|
verifyenable: "Verify and Enable"
|
||||||
update:
|
update:
|
||||||
updatesettingsflash: "Successfully updated settings."
|
updatesettingsflash: "Successfully updated settings."
|
||||||
|
passwordnotcorrect: "Your password was not correct."
|
||||||
stories:
|
stories:
|
||||||
edit:
|
edit:
|
||||||
edit: "Edit Story"
|
edit: "Edit Story"
|
||||||
|
|
|
@ -260,6 +260,7 @@ fr:
|
||||||
accountsettings: "Paramètres du compte"
|
accountsettings: "Paramètres du compte"
|
||||||
username: "Utilisateur :"
|
username: "Utilisateur :"
|
||||||
password: "Nouveau mot de passe :"
|
password: "Nouveau mot de passe :"
|
||||||
|
currentpassword: "Mot de passe actuel :"
|
||||||
confirmpassword: "Confirmer le mot de passe :"
|
confirmpassword: "Confirmer le mot de passe :"
|
||||||
emailaddress: "Adresse e-mail :"
|
emailaddress: "Adresse e-mail :"
|
||||||
gravatarized: "<a href=\"http://www.gravatar.com/\" target=\"_blank\">Gravatar</a>isé"
|
gravatarized: "<a href=\"http://www.gravatar.com/\" target=\"_blank\">Gravatar</a>isé"
|
||||||
|
@ -338,6 +339,7 @@ fr:
|
||||||
verifyenable: "Vérifier et Activer"
|
verifyenable: "Vérifier et Activer"
|
||||||
update:
|
update:
|
||||||
updatesettingsflash: "Paramètres mis à jour avec succès."
|
updatesettingsflash: "Paramètres mis à jour avec succès."
|
||||||
|
passwordnotcorrect: "Le mot de passe est incorrect."
|
||||||
stories:
|
stories:
|
||||||
edit:
|
edit:
|
||||||
edit: "Éditer l'info"
|
edit: "Éditer l'info"
|
||||||
|
|
Loading…
Reference in a new issue