Merge branch 'guange_dev' into 'develop'

去除个人信息编辑中的邮箱



See merge request !56
This commit is contained in:
黄井泉 2016-12-16 16:27:28 +08:00
commit 85d01a7392
4 changed files with 8 additions and 44 deletions

View File

@ -283,7 +283,6 @@ module Mobile
requires :token, type: String
requires :lastname, type: String
requires :sex, type: Integer
requires :mail, type: String
end
post 'edit_userinfo' do
@ -298,41 +297,11 @@ module Mobile
status = -1
end
if params[:mail].length > 60 then
message = "邮箱地址不能超过60个字符!"
status = -1
end
if !(params[:mail].match(/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i))
message = "请输入正确的邮箱地址!"
status = -1
end
if status == 0
# 修改邮箱的时候同步修改到gitlab
if user.mail != params[:mail]
g = Gitlab.client
begin
g.edit_user(user.gid, :email => params[:mail])
rescue
Rails.logger.error "sync user's email of gitlab failed!"
end
end
user.mail = params[:mail]
user.lastname = params[:lastname]
user.update_attribute(:lastname, params[:lastname])
se = user.extensions
se.gender = params[:sex]
if user.save && se.save
status = 0
else
message = "该邮箱地址已被使用!"
status = -1
end
se.update_attribute(:gender, params[:sex])
end
if status == 0

View File

@ -830,7 +830,7 @@ class ApplicationController < ActionController::Base
# Returns a string that can be used as filename value in Content-Disposition header
def filename_for_content_disposition(name)
request.env['HTTP_USER_AGENT'] =~ %r{MSIE|Trident} ? ERB::Util.url_encode(name) : name
request.env['HTTP_USER_AGENT'] =~ %r{MSIE|Trident|Edge} ? ERB::Util.url_encode(name) : name
end
def api_request?

View File

@ -26,10 +26,10 @@
</div>
</div>
<div class="course-list-row f13 c-grey3 mt10">
<span class="fl ml15 c-grey3">邮箱</span>
<input class="new-class-input ml25" type="email" name="email" ng-model="mail" placeholder="请输入您的邮箱地址" maxlength="60" />
</div>
<!--<div class="course-list-row f13 c-grey3 mt10">-->
<!--<span class="fl ml15 c-grey3">邮箱</span>-->
<!--<input class="new-class-input ml25" type="email" name="email" ng-model="mail" maxlength="60" disabled />-->
<!--</div>-->
<div ng-show="regFrm.$submitted || regFrm.email.$touched">
<span class="f12 c-red ml65" ng-show="regFrm.email.$error.required">电子邮箱地址不能为空</span>
<span class="f12 c-red ml65" ng-show="regFrm.email.$error.email">电子邮箱地址不合法</span>

View File

@ -64,18 +64,13 @@ app.controller('EditUserInfoController', ['$scope', 'config','$http', 'auth','$l
return;
}
if(vm.mail == ""){
vm.alertService_1.showMessage('提示', '邮箱不能为空');
return;
}
// if(!(/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i.test(vm.mail))){
// vm.alertService_1.showMessage('提示', '邮箱不合法');
// return;
// }
$http.post(config.apiUrl + "users/edit_userinfo",
{token: auth.token(),lastname: vm.lastname, sex: vm.sex, mail: vm.mail}
{token: auth.token(),lastname: vm.lastname, sex: vm.sex}
).then(function(response){
if(response.data.status == 0)
{