|
@@ -83,9 +83,13 @@ func Save(context *admin.Context) (interface{}, error) {
|
|
password = string(admin.Passworder.Hash([]byte(param.Password)))
|
|
password = string(admin.Passworder.Hash([]byte(param.Password)))
|
|
}
|
|
}
|
|
if param.LoginType == "2" { //点击发送手机验证码
|
|
if param.LoginType == "2" { //点击发送手机验证码
|
|
- _, err := thisModel.GetByPhone(param.Phone)
|
|
|
|
- if err == nil {
|
|
|
|
- return nil, errors.New("手机号已绑定其他账号")
|
|
|
|
|
|
+ phoneExist, _ := thisModel.GetByPhone(param.Phone)
|
|
|
|
+ if phoneExist.Id > 0 {
|
|
|
|
+ if phoneExist.Id != param.Id {
|
|
|
|
+ return nil, errors.New("手机号已绑定其他账号")
|
|
|
|
+ } else {
|
|
|
|
+ return nil, errors.New("手机号与原手机号一致")
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if SendPhoneIdentCode(context, param.Phone) {
|
|
if SendPhoneIdentCode(context, param.Phone) {
|
|
return map[string]interface{}{"status": 3}, nil
|
|
return map[string]interface{}{"status": 3}, nil
|
|
@@ -102,8 +106,8 @@ func Save(context *admin.Context) (interface{}, error) {
|
|
return nil, errors.New("手机验证码不能为空")
|
|
return nil, errors.New("手机验证码不能为空")
|
|
}
|
|
}
|
|
phoneCode := util.ObjToString(session.Values["code"])
|
|
phoneCode := util.ObjToString(session.Values["code"])
|
|
- // phone := util.ObjToString(session.Values["phone"])
|
|
|
|
- if phoneCode != param.PhoneCode {
|
|
|
|
|
|
+ phone := util.ObjToString(session.Values["phone"])
|
|
|
|
+ if phone != param.Phone || phoneCode != param.PhoneCode {
|
|
return nil, errors.New("手机验证码错误")
|
|
return nil, errors.New("手机验证码错误")
|
|
}
|
|
}
|
|
}
|
|
}
|