master
huanghai 5 years ago
parent 04b8a595bc
commit 0273e114ed

@ -297,7 +297,34 @@ func GetBureauIdsByPersonIds(personIds []string) ([]map[string]interface{}, stri
/**
*/
func CheckPwd(identityId int32,personId string,pwd string)bool{
//LdapUtil.GetLdapPassword
}
*/
func CheckPwd(identityId int32, personId string, pwd string) (bool, error) {
myBuilder := builder.Dialect(builder.MYSQL).Select("login_name").From("t_sys_loginperson").
Where(builder.Eq{"identity_id": identityId}).And(builder.Eq{"person_id": personId}).And(builder.Eq{"b_use": 1})
sql, err := myBuilder.ToBoundSQL()
if err != nil {
return false, err
}
list, _, err := SqlKit.Query(sql)
if list == nil || len(list) == 0 {
return false, nil
}
if list[0]["pwd"] == LdapUtil.GetLdapPassword(pwd) {
return true, nil
} else {
return false, nil
}
}
/**
*/
func UpdatePwd(identityId int32, personId string, pwd string) (bool, error) {
loginPerson := new(models.TSysLoginperson)
loginPerson.Pwd = LdapUtil.GetLdapPassword(pwd)
_, err := db.Where("identity_id = ?", identityId).And("person_id = ?", personId).Update(loginPerson)
if err != nil {
return false, err
}
return true, nil
}

@ -825,7 +825,7 @@ var file_SysLoginperson_proto_rawDesc = []byte{
0x73, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49,
0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f,
0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x32,
0x91, 0x08, 0x0a, 0x14, 0x53, 0x79, 0x73, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x70, 0x65, 0x72, 0x73,
0x9d, 0x08, 0x0a, 0x14, 0x53, 0x79, 0x73, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x70, 0x65, 0x72, 0x73,
0x6f, 0x6e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x12, 0x50, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53,
0x79, 0x73, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x12, 0x1d, 0x2e,
0x53, 0x79, 0x73, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x50, 0x72,
@ -884,18 +884,18 @@ var file_SysLoginperson_proto_rawDesc = []byte{
0x2e, 0x53, 0x79, 0x73, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x50,
0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x72, 0x67, 0x1a,
0x1a, 0x2e, 0x53, 0x79, 0x73, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e,
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x54, 0x0a,
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x60, 0x0a,
0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x50, 0x61, 0x73, 0x73,
0x57, 0x6f, 0x72, 0x64, 0x12, 0x1f, 0x2e, 0x53, 0x79, 0x73, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x70,
0x65, 0x72, 0x73, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x41, 0x72, 0x67, 0x1a, 0x1a, 0x2e, 0x53, 0x79, 0x73, 0x4c, 0x6f, 0x67, 0x69, 0x6e,
0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x70, 0x6c,
0x79, 0x22, 0x00, 0x42, 0x44, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x64, 0x73, 0x69, 0x64, 0x65,
0x61, 0x6c, 0x2e, 0x64, 0x73, 0x6d, 0x69, 0x6e, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x42, 0x0e, 0x53,
0x79, 0x73, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x50, 0x01, 0x5a,
0x15, 0x2e, 0x3b, 0x53, 0x79, 0x73, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x70, 0x65, 0x72, 0x73, 0x6f,
0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0xa2, 0x02, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
0x57, 0x6f, 0x72, 0x64, 0x12, 0x2b, 0x2e, 0x53, 0x79, 0x73, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x70,
0x65, 0x72, 0x73, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74,
0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x50, 0x61, 0x73, 0x73, 0x57, 0x6f, 0x72, 0x64, 0x41, 0x72,
0x67, 0x1a, 0x1a, 0x2e, 0x53, 0x79, 0x73, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x70, 0x65, 0x72, 0x73,
0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42,
0x44, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x64, 0x73, 0x69, 0x64, 0x65, 0x61, 0x6c, 0x2e, 0x64,
0x73, 0x6d, 0x69, 0x6e, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x42, 0x0e, 0x53, 0x79, 0x73, 0x4c, 0x6f,
0x67, 0x69, 0x6e, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x50, 0x01, 0x5a, 0x15, 0x2e, 0x3b, 0x53,
0x79, 0x73, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x50, 0x72, 0x6f,
0x74, 0x6f, 0xa2, 0x02, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -933,7 +933,7 @@ var file_SysLoginperson_proto_depIdxs = []int32{
2, // 8: SysLoginpersonProto.SysLoginpersonManage.ResetPassWord:input_type -> SysLoginpersonProto.ResetPassWordArg
1, // 9: SysLoginpersonProto.SysLoginpersonManage.EnableAccount:input_type -> SysLoginpersonProto.AccountArg
1, // 10: SysLoginpersonProto.SysLoginpersonManage.DisableAccount:input_type -> SysLoginpersonProto.AccountArg
1, // 11: SysLoginpersonProto.SysLoginpersonManage.UpdateLoginPassWord:input_type -> SysLoginpersonProto.AccountArg
0, // 11: SysLoginpersonProto.SysLoginpersonManage.UpdateLoginPassWord:input_type -> SysLoginpersonProto.UpdateLoginPassWordArg
6, // 12: SysLoginpersonProto.SysLoginpersonManage.GetSysLoginperson:output_type -> SysLoginpersonProto.Reply
6, // 13: SysLoginpersonProto.SysLoginpersonManage.AddSysLoginperson:output_type -> SysLoginpersonProto.Reply
6, // 14: SysLoginpersonProto.SysLoginpersonManage.DeleteSysLoginperson:output_type -> SysLoginpersonProto.Reply
@ -1111,7 +1111,7 @@ type SysLoginpersonManageClient interface {
//禁用账号
DisableAccount(ctx context.Context, in *AccountArg, opts ...grpc.CallOption) (*Reply, error)
//修改登录密码
UpdateLoginPassWord(ctx context.Context, in *AccountArg, opts ...grpc.CallOption) (*Reply, error)
UpdateLoginPassWord(ctx context.Context, in *UpdateLoginPassWordArg, opts ...grpc.CallOption) (*Reply, error)
}
type sysLoginpersonManageClient struct {
@ -1221,7 +1221,7 @@ func (c *sysLoginpersonManageClient) DisableAccount(ctx context.Context, in *Acc
return out, nil
}
func (c *sysLoginpersonManageClient) UpdateLoginPassWord(ctx context.Context, in *AccountArg, opts ...grpc.CallOption) (*Reply, error) {
func (c *sysLoginpersonManageClient) UpdateLoginPassWord(ctx context.Context, in *UpdateLoginPassWordArg, opts ...grpc.CallOption) (*Reply, error) {
out := new(Reply)
err := c.cc.Invoke(ctx, "/SysLoginpersonProto.SysLoginpersonManage/UpdateLoginPassWord", in, out, opts...)
if err != nil {
@ -1255,7 +1255,7 @@ type SysLoginpersonManageServer interface {
//禁用账号
DisableAccount(context.Context, *AccountArg) (*Reply, error)
//修改登录密码
UpdateLoginPassWord(context.Context, *AccountArg) (*Reply, error)
UpdateLoginPassWord(context.Context, *UpdateLoginPassWordArg) (*Reply, error)
}
// UnimplementedSysLoginpersonManageServer can be embedded to have forward compatible implementations.
@ -1295,7 +1295,7 @@ func (*UnimplementedSysLoginpersonManageServer) EnableAccount(context.Context, *
func (*UnimplementedSysLoginpersonManageServer) DisableAccount(context.Context, *AccountArg) (*Reply, error) {
return nil, status.Errorf(codes.Unimplemented, "method DisableAccount not implemented")
}
func (*UnimplementedSysLoginpersonManageServer) UpdateLoginPassWord(context.Context, *AccountArg) (*Reply, error) {
func (*UnimplementedSysLoginpersonManageServer) UpdateLoginPassWord(context.Context, *UpdateLoginPassWordArg) (*Reply, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateLoginPassWord not implemented")
}
@ -1502,7 +1502,7 @@ func _SysLoginpersonManage_DisableAccount_Handler(srv interface{}, ctx context.C
}
func _SysLoginpersonManage_UpdateLoginPassWord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AccountArg)
in := new(UpdateLoginPassWordArg)
if err := dec(in); err != nil {
return nil, err
}
@ -1514,7 +1514,7 @@ func _SysLoginpersonManage_UpdateLoginPassWord_Handler(srv interface{}, ctx cont
FullMethod: "/SysLoginpersonProto.SysLoginpersonManage/UpdateLoginPassWord",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SysLoginpersonManageServer).UpdateLoginPassWord(ctx, req.(*AccountArg))
return srv.(SysLoginpersonManageServer).UpdateLoginPassWord(ctx, req.(*UpdateLoginPassWordArg))
}
return interceptor(ctx, in, info, handler)
}

@ -37,7 +37,7 @@ service SysLoginpersonManage {
//
rpc DisableAccount (AccountArg) returns (Reply) {}
//
rpc UpdateLoginPassWord (AccountArg) returns (Reply) {}
rpc UpdateLoginPassWord (UpdateLoginPassWordArg) returns (Reply) {}
}
message UpdateLoginPassWordArg {

@ -210,7 +210,7 @@ func (s *Rpc) PageAreaManagerExcel(ctx context.Context, in *SysLoginpersonProto.
//重新设置长度和显示的页
in.Page = 1
in.Limit = 9999
in.Limit = Const.Int32Max
list, _, err := SysLoginpersonDao.PageAreaManager(in)
//错误处理
@ -231,13 +231,39 @@ func (s *Rpc) PageAreaManagerExcel(ctx context.Context, in *SysLoginpersonProto.
//更改人员登录密码
func (s *Rpc) UpdateLoginPassWord(ctx context.Context, in *SysLoginpersonProto.AccountArg) (*SysLoginpersonProto.Reply, error) {
func (s *Rpc) UpdateLoginPassWord(ctx context.Context, in *SysLoginpersonProto.UpdateLoginPassWordArg) (*SysLoginpersonProto.Reply, error) {
//rpc响应
var reply SysLoginpersonProto.Reply
//密码长度检查
if len(in.NewPassWord)<6 || len(in.NewPassWord)>20{
reply.Success = false
reply.Message = "输入的密码长度不正确应该在6-20之间。"
return &reply, nil
}
//(1)判断旧密码是不是正确
SysLoginpersonDao.CheckPwd(in.)
success,err:=SysLoginpersonDao.CheckPwd(in.IdentityId,in.PersonId,in.OldPassWord)
//错误处理
if err != nil {
reply.Success = false
reply.Message = Const.DataBaseActionError
LogUtil.Error(ErrorConst.SqlQueryError, "执行UpdateLoginPassWord时发生严重错误"+err.Error())
return &reply, err
}
if !success{
reply.Success = false
reply.Message = "输入的密码不正确!"
return &reply, nil
}
//(2)修改新密码
success,err=SysLoginpersonDao.UpdatePwd(in.IdentityId,in.PersonId,in.NewPassWord)
//错误处理
if err != nil {
reply.Success = false
reply.Message = Const.DataBaseActionError
LogUtil.Error(ErrorConst.SqlQueryError, "执行UpdatePwd时发生严重错误"+err.Error())
return &reply, err
}
reply.Success = success
reply.Message = Const.SuccessDataBaseAction
return &reply, nil
}
Loading…
Cancel
Save