Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
browser-backend
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
browser-backend
Commits
3e0c8343
Commit
3e0c8343
authored
Mar 14, 2020
by
renjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重置密码
parent
dab1fa7a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
AccountController.java
.../browserbackend/account/controller/AccountController.java
+2
-2
AccountServiceImpl.java
...owserbackend/account/service/impl/AccountServiceImpl.java
+2
-2
No files found.
src/main/java/com/edgec/browserbackend/account/controller/AccountController.java
View file @
3e0c8343
...
@@ -202,7 +202,7 @@ public class AccountController {
...
@@ -202,7 +202,7 @@ public class AccountController {
accountService
.
updateUserToken
(
username
,
token
);
accountService
.
updateUserToken
(
username
,
token
);
}
}
@RequestMapping
(
path
=
"/reset"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/reset
password
"
,
method
=
RequestMethod
.
POST
)
public
ResultDto
forgetPassword
(
@Valid
@RequestBody
UserDto
user
)
{
public
ResultDto
forgetPassword
(
@Valid
@RequestBody
UserDto
user
)
{
ResultDto
resultDto
=
new
ResultDto
();
ResultDto
resultDto
=
new
ResultDto
();
try
{
try
{
...
@@ -223,7 +223,7 @@ public class AccountController {
...
@@ -223,7 +223,7 @@ public class AccountController {
return
accountService
.
determUsernameOrEmail
(
text
);
return
accountService
.
determUsernameOrEmail
(
text
);
}
}
@RequestMapping
(
path
=
"/reset
withotp
"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/reset"
,
method
=
RequestMethod
.
POST
)
public
ResultDto
resetWithOtp
(
@Valid
@RequestBody
UserDto
user
)
{
public
ResultDto
resetWithOtp
(
@Valid
@RequestBody
UserDto
user
)
{
ResultDto
resultDto
=
new
ResultDto
();
ResultDto
resultDto
=
new
ResultDto
();
try
{
try
{
...
...
src/main/java/com/edgec/browserbackend/account/service/impl/AccountServiceImpl.java
View file @
3e0c8343
...
@@ -782,7 +782,7 @@ public class AccountServiceImpl implements AccountService {
...
@@ -782,7 +782,7 @@ public class AccountServiceImpl implements AccountService {
@Override
@Override
public
void
resetPasswordWithOtp
(
UserDto
user
)
{
public
void
resetPasswordWithOtp
(
UserDto
user
)
{
Otp
otp
=
otpRepository
.
findByPhoneAndCreatedAtGreaterThanEqual
(
user
.
get
Phon
e
(),
Otp
otp
=
otpRepository
.
findByPhoneAndCreatedAtGreaterThanEqual
(
user
.
get
Usernam
e
(),
Instant
.
now
().
minusSeconds
(
600
).
toEpochMilli
());
Instant
.
now
().
minusSeconds
(
600
).
toEpochMilli
());
if
(
otp
==
null
)
{
if
(
otp
==
null
)
{
throw
new
ClientRequestException
(
AccountErrorCode
.
OTPWRONG
,
AccountErrorCode
.
OTPWRONG
.
getReason
());
throw
new
ClientRequestException
(
AccountErrorCode
.
OTPWRONG
,
AccountErrorCode
.
OTPWRONG
.
getReason
());
...
@@ -791,7 +791,7 @@ public class AccountServiceImpl implements AccountService {
...
@@ -791,7 +791,7 @@ public class AccountServiceImpl implements AccountService {
throw
new
ClientRequestException
(
AccountErrorCode
.
OTPWRONG
,
AccountErrorCode
.
OTPWRONG
.
getReason
());
throw
new
ClientRequestException
(
AccountErrorCode
.
OTPWRONG
,
AccountErrorCode
.
OTPWRONG
.
getReason
());
}
}
Account
account
=
repository
.
findBy
PhoneNumber
(
user
.
getPhone
()
);
Account
account
=
repository
.
findBy
Id
(
user
.
getUsername
()).
orElse
(
null
);
if
(
account
==
null
)
if
(
account
==
null
)
throw
new
ClientRequestException
(
AccountErrorCode
.
PHONENOTEXIST
,
"Can't find account with phone "
+
user
.
getPhone
());
throw
new
ClientRequestException
(
AccountErrorCode
.
PHONENOTEXIST
,
"Can't find account with phone "
+
user
.
getPhone
());
...
...
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