Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
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
段启岩
beyond-clouds
Commits
17bf3245
Commit
17bf3245
authored
Feb 03, 2020
by
张晋雄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
短信验证登陆
parent
c11a31f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
src/main/java/cn/meteor/beyondclouds/modules/user/service/impl/AuthenticationServiceImpl.java
+6
-6
No files found.
src/main/java/cn/meteor/beyondclouds/modules/user/service/impl/AuthenticationServiceImpl.java
View file @
17bf3245
...
@@ -108,7 +108,12 @@ public class AuthenticationServiceImpl implements IAuthenticationService {
...
@@ -108,7 +108,12 @@ public class AuthenticationServiceImpl implements IAuthenticationService {
@Override
@Override
public
AuthenticationResult
smsAuthentication
(
String
mobile
,
String
verifyCode
)
throws
UserServiceException
,
AuthenticationServiceException
{
public
AuthenticationResult
smsAuthentication
(
String
mobile
,
String
verifyCode
)
throws
UserServiceException
,
AuthenticationServiceException
{
//1.检查验证码是否正确
//1. 查找用户是否存在
UserAuthLocal
userAuthLocal
=
userAuthLocalService
.
getByMobile
(
mobile
);
if
(
null
==
userAuthLocal
)
{
throw
new
AuthenticationServiceException
(
AuthenticationErrorCode
.
USER_NOT_FOUND
);
}
//2.检查验证码是否正确
String
realVerifyCode
=
redisHelper
.
get
(
RedisKey
.
VERIFY_CODE_KEY
(
mobile
));
String
realVerifyCode
=
redisHelper
.
get
(
RedisKey
.
VERIFY_CODE_KEY
(
mobile
));
if
(
StringUtils
.
isEmpty
(
realVerifyCode
)
||
!
realVerifyCode
.
equals
(
verifyCode
))
{
if
(
StringUtils
.
isEmpty
(
realVerifyCode
)
||
!
realVerifyCode
.
equals
(
verifyCode
))
{
throw
new
UserServiceException
(
UserErrorCode
.
REG_VERIFY_CODE_ERROR
);
throw
new
UserServiceException
(
UserErrorCode
.
REG_VERIFY_CODE_ERROR
);
...
@@ -117,11 +122,6 @@ public class AuthenticationServiceImpl implements IAuthenticationService {
...
@@ -117,11 +122,6 @@ public class AuthenticationServiceImpl implements IAuthenticationService {
// 删除验证码
// 删除验证码
redisHelper
.
del
(
RedisKey
.
VERIFY_CODE_KEY
(
mobile
));
redisHelper
.
del
(
RedisKey
.
VERIFY_CODE_KEY
(
mobile
));
//2. 查找用户是否存在
UserAuthLocal
userAuthLocal
=
userAuthLocalService
.
getByMobile
(
mobile
);
if
(
null
==
userAuthLocal
)
{
throw
new
AuthenticationServiceException
(
AuthenticationErrorCode
.
USER_NOT_FOUND
);
}
// 根据userId生成token并返回
// 根据userId生成token并返回
return
makeAuthenticationResult
(
userAuthLocal
.
getUserId
());
return
makeAuthenticationResult
(
userAuthLocal
.
getUserId
());
...
...
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