Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
1499f4a4
Commit
1499f4a4
authored
4 years ago
by
lal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交
parent
659cd8ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
18 deletions
+54
-18
src/main/java/cn/timer/api/controller/LoginController.java
+54
-18
No files found.
src/main/java/cn/timer/api/controller/LoginController.java
View file @
1499f4a4
...
...
@@ -346,26 +346,33 @@ public class LoginController {
Integer
type
=
entRegisterDto
.
getPwUpdateType
();
// 验证方式
QyzxEmpLogin
qyzxEmpLogin
=
new
LambdaQueryChainWrapper
<
QyzxEmpLogin
>(
qyzxEmpLoginMapper
)
.
eq
(!
StrUtil
.
hasBlank
(
phone
),
QyzxEmpLogin:
:
getPhone
,
phone
).
one
();
// 员工登录表
String
dbPwd
=
qyzxEmpLogin
.
getPw
();
// 数据库原密码
if
(
type
==
1
)
{
if
(!
Md5
.
md5
(
oldPwd
).
equals
(
dbPwd
))
{
return
ResultUtil
.
error
(
"原密码验证失败"
);
}
if
(
pw
.
equals
(
oldPwd
))
{
return
ResultUtil
.
error
(
"新密码与原密码相同,请修改后重试!"
);
}
}
else
{
String
codeRedis
=
session
.
getAttribute
(
phone
)
!=
null
?
session
.
getAttribute
(
phone
).
toString
()
:
""
;
if
(!
code
.
equals
(
codeRedis
))
{
return
ResultUtil
.
error
(
"短信验证码错误"
);
}
if
(
Md5
.
md5
(
pw
).
equals
(
dbPwd
))
{
return
ResultUtil
.
error
(
"新密码与原密码相同,请修改后重试!"
);
if
(
qyzxEmpLogin
!=
null
)
{
String
dbPwd
=
qyzxEmpLogin
.
getPw
();
// 数据库原密码
if
(
type
==
1
)
{
if
(!
Md5
.
md5
(
oldPwd
).
equals
(
dbPwd
))
{
return
ResultUtil
.
error
(
"原密码验证失败"
);
}
if
(
pw
.
equals
(
oldPwd
))
{
return
ResultUtil
.
error
(
"新密码与原密码相同,请修改后重试!"
);
}
}
else
{
String
codeRedis
=
session
.
getAttribute
(
phone
)
!=
null
?
session
.
getAttribute
(
phone
).
toString
()
:
""
;
if
(!
code
.
equals
(
codeRedis
))
{
return
ResultUtil
.
error
(
"短信验证码错误"
);
}
if
(
Md5
.
md5
(
pw
).
equals
(
dbPwd
))
{
return
ResultUtil
.
error
(
"新密码与原密码相同,请修改后重试!"
);
}
}
qyzxEmpLogin
.
setPw
(
Md5
.
md5
(
pw
));
qyzxEmpLogin
.
updateById
();
return
ResultUtil
.
success
(
"修改成功"
);
}
else
{
return
ResultUtil
.
error
(
"账号不存在"
);
}
qyzxEmpLogin
.
setPw
(
Md5
.
md5
(
pw
));
qyzxEmpLogin
.
updateById
();
return
ResultUtil
.
success
(
"修改成功"
);
}
/**
...
...
@@ -444,10 +451,30 @@ public class LoginController {
String
code
=
entRegisterDto
.
getCode
();
// String codeRedis = redisTemplate.get(phone).toString();
String
codeRedis
=
session
.
getAttribute
(
phone
)
!=
null
?
session
.
getAttribute
(
phone
).
toString
()
:
""
;
if
(
authentication_code
!=
null
&&
!(
""
).
equals
(
authentication_code
))
{
if
(
authentication_code
.
equals
(
code
))
{
QyzxEmpLogin
qyzxEmpLogin1
=
qyzxEmpLoginMapper
.
selectById
(
empNum
);
if
(
qyzxEmpLogin1
!=
null
)
{
qyzxEmpLogin1
.
setPhone
(
phone
);
qyzxEmpLogin1
.
setPw
(
Md5
.
md5
(
pwd
));
// 密码初始化
qyzxEmpLogin1
.
updateById
();
// 员工信息 手机号修改
YgglMainEmp
.
builder
().
phone
(
phone
).
build
().
update
(
new
UpdateWrapper
<
YgglMainEmp
>().
lambda
().
eq
(
YgglMainEmp:
:
getEmpNum
,
qyzxEmpLogin1
.
getId
()));
return
ResultUtil
.
success
(
"修改手机号/用户名成功"
);
}
}
}
if
(
code
==
null
||
!
code
.
toString
().
equals
(
codeRedis
))
{
return
ResultUtil
.
error
(
"验证码不符/失效"
);
}
QyzxEmpLogin
qyzxEmpLogin1
=
qyzxEmpLoginMapper
.
selectById
(
empNum
);
if
(
qyzxEmpLogin1
!=
null
)
{
...
...
@@ -673,7 +700,16 @@ public class LoginController {
String
phone
=
entRegisterDto
.
getPhone
();
String
codeRedis
=
session
.
getAttribute
(
phone
)
!=
null
?
session
.
getAttribute
(
phone
).
toString
()
:
""
;
if
(
authentication_code
!=
null
&&
!(
""
).
equals
(
authentication_code
))
{
if
(
authentication_code
.
equals
(
code
))
{
QyzxEmpLogin
qyzxEmpLogin1
=
new
LambdaQueryChainWrapper
<
QyzxEmpLogin
>(
qyzxEmpLoginMapper
)
.
eq
(!
StrUtil
.
hasBlank
(
phone
),
QyzxEmpLogin:
:
getPhone
,
phone
).
one
();
return
loginhan
(
qyzxEmpLogin1
,
request
);
}
}
if
(
codeRedis
==
null
||
!
code
.
equals
(
codeRedis
))
return
ResultUtil
.
error
(
"验证码不符"
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment