Skip to content

Commit

Permalink
Print notice after password changed successfully
Browse files Browse the repository at this point in the history
  • Loading branch information
martinemde committed Nov 29, 2024
1 parent 315cbbb commit 5d39d43
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/passwords_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def update
@user.reset_api_key! if reset_params[:reset_api_key] == "true" # singular
@user.api_keys.expire_all! if reset_params[:reset_api_keys] == "true" # plural
delete_password_reset_session
flash[:notice] = t(".success")
redirect_to signed_in? ? dashboard_path : sign_in_path
else
flash.now[:alert] = t(".failure")
Expand Down
1 change: 1 addition & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ de:
Ändern deines Passworts.
failure_on_missing_email: Die E-Mail darf nicht leer sein.
update:
success:
failure: Dein Passwort konnte nicht geändert werden. Bitte versuche es erneut.
multifactor_auths:
session_expired: Deine Sitzung auf der Anmeldeseite ist abgelaufen.
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ en:
success: You will receive an email within the next few minutes. It contains instructions for changing your password.
failure_on_missing_email: Email can't be blank.
update:
success: Your password has been changed.
failure: Your password could not be changed. Please try again.
multifactor_auths:
session_expired: Your login page session has expired.
Expand Down
1 change: 1 addition & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ es:
success:
failure_on_missing_email:
update:
success:
failure:
multifactor_auths:
session_expired: Ha expirado tu sesión en la página de acceso.
Expand Down
1 change: 1 addition & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ fr:
success:
failure_on_missing_email:
update:
success:
failure:
multifactor_auths:
session_expired:
Expand Down
1 change: 1 addition & 0 deletions config/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ ja:
success: 数分でEメールが届きます。メールにはパスワードを変更する手順が記載されています。
failure_on_missing_email: Eメールは空にできません。
update:
success:
failure: パスワードを変更できませんでした。もう一度お試しください。
multifactor_auths:
session_expired: ログインページのセッションが期限切れになりました。
Expand Down
1 change: 1 addition & 0 deletions config/locales/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ nl:
success:
failure_on_missing_email:
update:
success:
failure:
multifactor_auths:
session_expired:
Expand Down
1 change: 1 addition & 0 deletions config/locales/pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ pt-BR:
success:
failure_on_missing_email:
update:
success:
failure:
multifactor_auths:
session_expired:
Expand Down
1 change: 1 addition & 0 deletions config/locales/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ zh-CN:
success:
failure_on_missing_email:
update:
success:
failure:
multifactor_auths:
session_expired: 您的登录页面会话已过期。
Expand Down
1 change: 1 addition & 0 deletions config/locales/zh-TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ zh-TW:
success:
failure_on_missing_email:
update:
success:
failure:
multifactor_auths:
session_expired: 您的登入頁面工作階段已過期。
Expand Down
4 changes: 4 additions & 0 deletions test/functional/passwords_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ class PasswordsControllerTest < ActionController::TestCase
end

should redirect_to("the dashboard") { dashboard_path }
should set_flash[:notice].to "Your password has been changed."

should "not change api_key" do
assert_equal(@user.reload.api_key, @api_key)
Expand All @@ -554,6 +555,7 @@ class PasswordsControllerTest < ActionController::TestCase
end

should redirect_to("the dashboard") { dashboard_path }
should set_flash[:notice].to "Your password has been changed."

should "not change api_key" do
assert_equal(@user.reload.api_key, @api_key)
Expand All @@ -571,6 +573,7 @@ class PasswordsControllerTest < ActionController::TestCase
end

should redirect_to("the dashboard") { dashboard_path }
should set_flash[:notice].to "Your password has been changed."

should "change api_key" do
refute_equal(@user.reload.api_key, @api_key)
Expand All @@ -592,6 +595,7 @@ class PasswordsControllerTest < ActionController::TestCase
end

should redirect_to("the dashboard") { dashboard_path }
should set_flash[:notice].to "Your password has been changed."

should "change api_key" do
refute_equal(@user.reload.api_key, @api_key)
Expand Down

0 comments on commit 5d39d43

Please sign in to comment.