summaryrefslogtreecommitdiff
path: root/app/controllers/profiles
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/profiles')
-rw-r--r--app/controllers/profiles/notifications_controller.rb5
-rw-r--r--app/controllers/profiles/passwords_controller.rb11
-rw-r--r--app/controllers/profiles/preferences_controller.rb7
-rw-r--r--app/controllers/profiles/two_factor_auths_controller.rb4
4 files changed, 15 insertions, 12 deletions
diff --git a/app/controllers/profiles/notifications_controller.rb b/app/controllers/profiles/notifications_controller.rb
index 1fd1d6882df..46d5badc1a3 100644
--- a/app/controllers/profiles/notifications_controller.rb
+++ b/app/controllers/profiles/notifications_controller.rb
@@ -1,3 +1,4 @@
+#encoding: utf-8
class Profiles::NotificationsController < Profiles::ApplicationController
def show
@user = current_user
@@ -24,9 +25,9 @@ class Profiles::NotificationsController < Profiles::ApplicationController
respond_to do |format|
format.html do
if @saved
- flash[:notice] = "Notification settings saved"
+ flash[:notice] = "通知设置已保存"
else
- flash[:alert] = "Failed to save new settings"
+ flash[:alert] = "保存新设置失败"
end
redirect_back_or_default(default: profile_notifications_path)
diff --git a/app/controllers/profiles/passwords_controller.rb b/app/controllers/profiles/passwords_controller.rb
index c780e0983f9..fa40e954f49 100644
--- a/app/controllers/profiles/passwords_controller.rb
+++ b/app/controllers/profiles/passwords_controller.rb
@@ -1,3 +1,4 @@
+#encoding: utf-8
class Profiles::PasswordsController < Profiles::ApplicationController
skip_before_action :check_password_expiration, only: [:new, :create]
@@ -11,7 +12,7 @@ class Profiles::PasswordsController < Profiles::ApplicationController
def create
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: '必须提供一个有效的当前密码'
return
end
@@ -26,7 +27,7 @@ class Profiles::PasswordsController < Profiles::ApplicationController
if result
@user.update_attributes(password_expires_at: nil)
- redirect_to root_path, notice: 'Password successfully changed'
+ redirect_to root_path, notice: '密码修改成功'
else
render :new
end
@@ -42,12 +43,12 @@ class Profiles::PasswordsController < Profiles::ApplicationController
password_attributes[:password_automatically_set] = false
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: '必须提供一个有效的当前密码'
return
end
if @user.update_attributes(password_attributes)
- flash[:notice] = "Password was successfully updated. Please login with it"
+ flash[:notice] = "密码已成功更新。请使用新密码重新登录"
redirect_to new_user_session_path
else
render 'edit'
@@ -56,7 +57,7 @@ class Profiles::PasswordsController < Profiles::ApplicationController
def reset
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: '已发送重置密码操作的电子邮件'
end
private
diff --git a/app/controllers/profiles/preferences_controller.rb b/app/controllers/profiles/preferences_controller.rb
index a9a06ecc808..1559a191ba2 100644
--- a/app/controllers/profiles/preferences_controller.rb
+++ b/app/controllers/profiles/preferences_controller.rb
@@ -1,3 +1,4 @@
+#encoding: utf-8
class Profiles::PreferencesController < Profiles::ApplicationController
before_action :user
@@ -7,13 +8,13 @@ class Profiles::PreferencesController < Profiles::ApplicationController
def update
begin
if @user.update_attributes(preferences_params)
- flash[:notice] = 'Preferences saved.'
+ flash[:notice] = '偏好设置已保存。'
else
- flash[:alert] = 'Failed to save preferences.'
+ flash[:alert] = '保存偏好设置失败。'
end
rescue ArgumentError => e
# Raised when `dashboard` is given an invalid value.
- flash[:alert] = "Failed to save preferences (#{e.message})."
+ flash[:alert] = "保存偏好设置失败(#{e.message})。"
end
respond_to do |format|
diff --git a/app/controllers/profiles/two_factor_auths_controller.rb b/app/controllers/profiles/two_factor_auths_controller.rb
index 8f83fdd02bc..4f58033b659 100644
--- a/app/controllers/profiles/two_factor_auths_controller.rb
+++ b/app/controllers/profiles/two_factor_auths_controller.rb
@@ -14,10 +14,10 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController
if two_factor_authentication_required?
if two_factor_grace_period_expired?
- flash.now[:alert] = 'You must enable Two-factor Authentication for your account.'
+ flash.now[:alert] = '您必须给您的账户启用两步验证。'
else
grace_period_deadline = current_user.otp_grace_period_started_at + two_factor_grace_period.hours
- flash.now[:alert] = "You must enable Two-factor Authentication for your account before #{l(grace_period_deadline)}."
+ flash.now[:alert] = "您必须在 #{l(grace_period_deadline)} 之前给您的账户启用两步验证。"
end
end