修改邮箱的时候同步到gitlab

This commit is contained in:
huang 2015-12-10 10:50:15 +08:00
parent db582fd639
commit 4e0b442309
2 changed files with 12 additions and 1 deletions

View File

@ -109,12 +109,23 @@ class MyController < ApplicationController
# Edit user's account
def account
@user = User.current
lg=@user.login
@pref = @user.pref
diskfile = disk_filename('User', @user.id)
diskfile1 = diskfile + 'temp'
begin
if request.post?
# 修改邮箱的时候同步修改到gitlab
if @user.mail != params[:user][:mail]
g = Gitlab.client
begin
g.edit_user(@user.gid, :email => params[:user][:mail])
rescue
logger.error "sync user's email of gitlab failed!"
end
end
@user.safe_attributes = params[:user]
@user.pref.attributes = params[:pref]
@user.pref[:no_self_notified] = (params[:no_self_notified] == '1')

View File

@ -52,7 +52,7 @@ zh:
label_mail_attention: "qq邮箱可能收不到此邮件其他邮箱如果没有收到可能在垃圾邮件中"
label_mail_attention1: "其中gmail与教育网邮箱的激活邮件有时比较慢请耐心等待。"
# register中js判断密码设置是否合法提示信息
setting_password_min_length_limit: "密码长度至少大于 %{count} 个字符。"
setting_password_min_length_limit: "密码长度至少大于等于 %{count} 个字符。"
setting_password_error: "密码长度不够或密码不一致"
setting_password_success: "密码设置成功"
# account_controller中register方法判断注册成功的提示信息