Commit 90db2619 authored by antonyliu's avatar antonyliu

Externalize strings of password page in user profile

parent 4a938724
...@@ -14,7 +14,7 @@ class Profiles::PasswordsController < Profiles::ApplicationController ...@@ -14,7 +14,7 @@ class Profiles::PasswordsController < Profiles::ApplicationController
def create def create
unless @user.password_automatically_set || @user.valid_password?(user_params[:current_password]) unless @user.password_automatically_set || @user.valid_password?(user_params[:current_password])
redirect_to new_profile_password_path, alert: 'You must provide a valid current password' redirect_to new_profile_password_path, alert: _('You must provide a valid current password')
return return
end end
...@@ -29,7 +29,7 @@ class Profiles::PasswordsController < Profiles::ApplicationController ...@@ -29,7 +29,7 @@ class Profiles::PasswordsController < Profiles::ApplicationController
if result[:status] == :success if result[:status] == :success
Users::UpdateService.new(current_user, user: @user, password_expires_at: nil).execute Users::UpdateService.new(current_user, user: @user, password_expires_at: nil).execute
redirect_to root_path, notice: 'Password successfully changed' redirect_to root_path, notice: _('Password successfully changed')
else else
render :new render :new
end end
...@@ -45,14 +45,14 @@ class Profiles::PasswordsController < Profiles::ApplicationController ...@@ -45,14 +45,14 @@ class Profiles::PasswordsController < Profiles::ApplicationController
password_attributes[:password_automatically_set] = false password_attributes[:password_automatically_set] = false
unless @user.password_automatically_set || @user.valid_password?(user_params[:current_password]) unless @user.password_automatically_set || @user.valid_password?(user_params[:current_password])
redirect_to edit_profile_password_path, alert: 'You must provide a valid current password' redirect_to edit_profile_password_path, alert: _('You must provide a valid current password')
return return
end end
result = Users::UpdateService.new(current_user, password_attributes.merge(user: @user)).execute result = Users::UpdateService.new(current_user, password_attributes.merge(user: @user)).execute
if result[:status] == :success if result[:status] == :success
flash[:notice] = "Password was successfully updated. Please login with it" flash[:notice] = _('Password was successfully updated. Please login with it')
redirect_to new_user_session_path redirect_to new_user_session_path
else else
@user.reset @user.reset
...@@ -62,7 +62,7 @@ class Profiles::PasswordsController < Profiles::ApplicationController ...@@ -62,7 +62,7 @@ class Profiles::PasswordsController < Profiles::ApplicationController
def reset def reset
current_user.send_reset_password_instructions current_user.send_reset_password_instructions
redirect_to edit_profile_password_path, notice: 'We sent you an email with reset password instructions' redirect_to edit_profile_password_path, notice: _('We sent you an email with reset password instructions')
end end
private private
......
- breadcrumb_title "Edit Password" - breadcrumb_title _('Edit Password')
- page_title "Password" - page_title _('Password')
- @content_class = "limit-container-width" unless fluid_layout - @content_class = "limit-container-width" unless fluid_layout
.row.prepend-top-default .row.prepend-top-default
...@@ -7,28 +7,28 @@ ...@@ -7,28 +7,28 @@
%h4.prepend-top-0 %h4.prepend-top-0
= page_title = page_title
%p %p
After a successful password update, you will be redirected to the login page where you can log in with your new password. = _('After a successful password update, you will be redirected to the login page where you can log in with your new password.')
.col-lg-8 .col-lg-8
%h5.prepend-top-0 %h5.prepend-top-0
Change your password = _('Change your password')
- unless @user.password_automatically_set? - unless @user.password_automatically_set?
or recover your current one = _('or recover your current one')
= form_for @user, url: profile_password_path, method: :put, html: {class: "update-password"} do |f| = form_for @user, url: profile_password_path, method: :put, html: {class: "update-password"} do |f|
= form_errors(@user) = form_errors(@user)
- unless @user.password_automatically_set? - unless @user.password_automatically_set?
.form-group .form-group
= f.label :current_password, class: 'label-bold' = f.label :current_password, _('Current password'), class: 'label-bold'
= f.password_field :current_password, required: true, class: 'form-control' = f.password_field :current_password, required: true, class: 'form-control'
%p.form-text.text-muted %p.form-text.text-muted
You must provide your current password in order to change it. = _('You must provide your current password in order to change it.')
.form-group .form-group
= f.label :password, 'New password', class: 'label-bold' = f.label :password, _('New password'), class: 'label-bold'
= f.password_field :password, required: true, class: 'form-control' = f.password_field :password, required: true, class: 'form-control'
.form-group .form-group
= f.label :password_confirmation, class: 'label-bold' = f.label :password_confirmation, _('Password confirmation'), class: 'label-bold'
= f.password_field :password_confirmation, required: true, class: 'form-control' = f.password_field :password_confirmation, required: true, class: 'form-control'
.prepend-top-default.append-bottom-default .prepend-top-default.append-bottom-default
= f.submit 'Save password', class: "btn btn-success append-right-10" = f.submit _('Save password'), class: "btn btn-success append-right-10"
- unless @user.password_automatically_set? - unless @user.password_automatically_set?
= link_to "I forgot my password", reset_profile_password_path, method: :put, class: "account-btn-link" = link_to _('I forgot my password'), reset_profile_password_path, method: :put, class: "account-btn-link"
...@@ -751,6 +751,9 @@ msgstr "" ...@@ -751,6 +751,9 @@ msgstr ""
msgid "After a successful password update you will be redirected to login screen." msgid "After a successful password update you will be redirected to login screen."
msgstr "" msgstr ""
msgid "After a successful password update, you will be redirected to the login page where you can log in with your new password."
msgstr ""
msgid "All" msgid "All"
msgstr "" msgstr ""
...@@ -1770,6 +1773,9 @@ msgstr "" ...@@ -1770,6 +1773,9 @@ msgstr ""
msgid "Change title" msgid "Change title"
msgstr "" msgstr ""
msgid "Change your password"
msgstr ""
msgid "ChangeTypeActionLabel|Pick into branch" msgid "ChangeTypeActionLabel|Pick into branch"
msgstr "" msgstr ""
...@@ -3101,6 +3107,9 @@ msgstr "" ...@@ -3101,6 +3107,9 @@ msgstr ""
msgid "Current Branch" msgid "Current Branch"
msgstr "" msgstr ""
msgid "Current password"
msgstr ""
msgid "CurrentUser|Profile" msgid "CurrentUser|Profile"
msgstr "" msgstr ""
...@@ -3607,6 +3616,9 @@ msgstr "" ...@@ -3607,6 +3616,9 @@ msgstr ""
msgid "Edit Milestone" msgid "Edit Milestone"
msgstr "" msgstr ""
msgid "Edit Password"
msgstr ""
msgid "Edit Pipeline Schedule %{id}" msgid "Edit Pipeline Schedule %{id}"
msgstr "" msgstr ""
...@@ -4988,6 +5000,9 @@ msgstr "" ...@@ -4988,6 +5000,9 @@ msgstr ""
msgid "I accept the|Terms of Service and Privacy Policy" msgid "I accept the|Terms of Service and Privacy Policy"
msgstr "" msgstr ""
msgid "I forgot my password"
msgstr ""
msgid "I have read and agree to the Let's Encrypt %{link_start}Terms of Service%{link_end}" msgid "I have read and agree to the Let's Encrypt %{link_start}Terms of Service%{link_end}"
msgstr "" msgstr ""
...@@ -6359,6 +6374,9 @@ msgstr "" ...@@ -6359,6 +6374,9 @@ msgstr ""
msgid "New milestone" msgid "New milestone"
msgstr "" msgstr ""
msgid "New password"
msgstr ""
msgid "New pipelines will cancel older, pending pipelines on the same branch" msgid "New pipelines will cancel older, pending pipelines on the same branch"
msgstr "" msgstr ""
...@@ -6814,6 +6832,15 @@ msgstr "" ...@@ -6814,6 +6832,15 @@ msgstr ""
msgid "Password authentication is unavailable." msgid "Password authentication is unavailable."
msgstr "" msgstr ""
msgid "Password confirmation"
msgstr ""
msgid "Password successfully changed"
msgstr ""
msgid "Password was successfully updated. Please login with it"
msgstr ""
msgid "Past due" msgid "Past due"
msgstr "" msgstr ""
...@@ -8477,6 +8504,9 @@ msgstr "" ...@@ -8477,6 +8504,9 @@ msgstr ""
msgid "Save comment" msgid "Save comment"
msgstr "" msgstr ""
msgid "Save password"
msgstr ""
msgid "Save pipeline schedule" msgid "Save pipeline schedule"
msgstr "" msgstr ""
...@@ -11026,6 +11056,9 @@ msgstr "" ...@@ -11026,6 +11056,9 @@ msgstr ""
msgid "We heard back from your U2F device. You have been authenticated." msgid "We heard back from your U2F device. You have been authenticated."
msgstr "" msgstr ""
msgid "We sent you an email with reset password instructions"
msgstr ""
msgid "We want to be sure it is you, please confirm you are not a robot." msgid "We want to be sure it is you, please confirm you are not a robot."
msgstr "" msgstr ""
...@@ -11436,6 +11469,12 @@ msgstr "" ...@@ -11436,6 +11469,12 @@ msgstr ""
msgid "You must have permission to create a project in a namespace before forking." msgid "You must have permission to create a project in a namespace before forking."
msgstr "" msgstr ""
msgid "You must provide a valid current password"
msgstr ""
msgid "You must provide your current password in order to change it."
msgstr ""
msgid "You need permission." msgid "You need permission."
msgstr "" msgstr ""
...@@ -12063,6 +12102,9 @@ msgstr "" ...@@ -12063,6 +12102,9 @@ msgstr ""
msgid "or" msgid "or"
msgstr "" msgstr ""
msgid "or recover your current one"
msgstr ""
msgid "out of %d total test" msgid "out of %d total test"
msgid_plural "out of %d total tests" msgid_plural "out of %d total tests"
msgstr[0] "" msgstr[0] ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment