Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
head_group
xyqb-user2
Commits
18ac5786
Commit
18ac5786
authored
Mar 13, 2020
by
杨锐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RuntimeException => DataException,友好提示。
parent
c5ba36de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
PwdVerifyStrategy.java
...yqb/controller/middleoffice/common/PwdVerifyStrategy.java
+2
-1
LoginModule.java
...group/xyqb/controller/middleoffice/login/LoginModule.java
+4
-3
No files found.
src/main/java/cn/quantgroup/xyqb/controller/middleoffice/common/PwdVerifyStrategy.java
View file @
18ac5786
package
cn
.
quantgroup
.
xyqb
.
controller
.
middleoffice
.
common
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.exception.DataException
;
import
org.springframework.stereotype.Component
;
import
java.util.Objects
;
...
...
@@ -22,6 +23,6 @@ public class PwdVerifyStrategy implements IVerifyStrategy {
return
;
}
//todo 自定义异常
throw
new
Runtime
Exception
(
"用户名或密码错误"
);
throw
new
Data
Exception
(
"用户名或密码错误"
);
}
}
src/main/java/cn/quantgroup/xyqb/controller/middleoffice/login/LoginModule.java
View file @
18ac5786
...
...
@@ -3,6 +3,7 @@ package cn.quantgroup.xyqb.controller.middleoffice.login;
import
cn.quantgroup.xyqb.controller.middleoffice.common.VerifyStrategyFactory
;
import
cn.quantgroup.xyqb.controller.middleoffice.common.VerifyTypeEnum
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.exception.DataException
;
import
cn.quantgroup.xyqb.model.AuthBean
;
import
cn.quantgroup.xyqb.model.LoginProperties
;
import
cn.quantgroup.xyqb.service.register.IUserRegisterService
;
...
...
@@ -41,14 +42,14 @@ public class LoginModule implements ILoginModule {
user
=
userRegisterService
.
register
(
channelId
,
phoneNo
);
}
else
{
//todo 自定义异常
throw
new
Runtime
Exception
(
"用户名或密码不正确"
);
throw
new
Data
Exception
(
"用户名或密码不正确"
);
}
}
if
(!
user
.
getEnable
())
{
//用户不存在
log
.
info
(
"用户尝试登录,已注销:{}"
,
phoneNo
);
//todo 自定义异常
throw
new
Runtime
Exception
(
"用户名或密码不正确"
);
throw
new
Data
Exception
(
"用户名或密码不正确"
);
}
//验证
...
...
@@ -73,7 +74,7 @@ public class LoginModule implements ILoginModule {
User
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
if
(
user
==
null
)
{
//todo 自定义异常
throw
new
Runtime
Exception
(
"用户不存在"
);
throw
new
Data
Exception
(
"用户不存在"
);
}
VerifyStrategyFactory
.
get
(
type
).
verify
(
user
,
verify
);
userService
.
resetPassword
(
phoneNo
,
password
);
...
...
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