Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sentinel
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
曲欣亮
sentinel
Commits
3ad764a7
Commit
3ad764a7
authored
Oct 18, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增修改密码接口
parent
342b6ae3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
3 deletions
+26
-3
MemberOpenApiController.java
...main/java/com/egolm/film/api/MemberOpenApiController.java
+1
-1
MemberInfoController.java
.../java/com/egolm/film/api/member/MemberInfoController.java
+9
-0
MemberService.java
...java/com/egolm/film/api/member/service/MemberService.java
+3
-1
MemberServiceImpl.java
...egolm/film/api/member/service/impl/MemberServiceImpl.java
+13
-1
No files found.
src/main/java/com/egolm/film/api/MemberOpenApiController.java
View file @
3ad764a7
...
...
@@ -85,7 +85,7 @@ public class MemberOpenApiController {
String
password
=
String
.
valueOf
(
code
);
Fc_member
member
=
memberService
.
getMemberByEmail
(
email
);
String
encodePwd
=
Common
.
encodePassword
(
password
,
member
.
getSalt
());
memberService
.
change
Password
(
member
.
getId
(),
encodePwd
);
memberService
.
reset
Password
(
member
.
getId
(),
encodePwd
);
String
name
=
member
.
getUsername
();
String
subject
=
messages
.
get
(
"email.getPassword.subject"
);
String
content
=
messages
.
get
(
"email.getPassword.content"
,
name
==
null
?
""
:
name
,
password
);
...
...
src/main/java/com/egolm/film/api/member/MemberInfoController.java
View file @
3ad764a7
...
...
@@ -55,4 +55,13 @@ public class MemberInfoController {
return
Rjx
.
jsonOk
();
}
@ResponseBody
@PostMapping
(
"changePassword"
)
@ApiOperation
(
"修改密码"
)
public
Object
changePassword
(
String
password
,
String
newPassword
)
{
LoginToken
loginToken
=
tokenService
.
getToken
();
Integer
id
=
(
Integer
)
loginToken
.
getId
();
boolean
boo
=
memberService
.
changePasswordByMemberId
(
id
,
password
,
newPassword
);
return
Rjx
.
json
().
setCode
(
boo
?
200
:
500
);
}
}
src/main/java/com/egolm/film/api/member/service/MemberService.java
View file @
3ad764a7
...
...
@@ -15,7 +15,7 @@ public interface MemberService {
Fc_member
getMemberByEmail
(
String
email
);
void
change
Password
(
Integer
id
,
String
newPassword
);
void
reset
Password
(
Integer
id
,
String
newPassword
);
void
saveMember
(
Fc_member
member
);
...
...
@@ -120,4 +120,6 @@ public interface MemberService {
String
film_apply_mobile
,
String
film_apply_country
);
boolean
changePasswordByMemberId
(
Integer
member_id
,
String
password
,
String
newPassword
);
}
src/main/java/com/egolm/film/api/member/service/impl/MemberServiceImpl.java
View file @
3ad764a7
...
...
@@ -27,6 +27,7 @@ import com.egolm.film.bean.Fc_member_film_issuer;
import
com.egolm.film.bean.Fc_member_film_playactor
;
import
com.egolm.film.bean.Fc_member_film_show
;
import
com.egolm.film.common.Messages
;
import
com.egolm.film.config.Common
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.XException
;
...
...
@@ -41,7 +42,7 @@ public class MemberServiceImpl implements MemberService {
private
JdbcTemplate
jdbcTemplate
;
@Override
public
void
change
Password
(
Integer
id
,
String
newPassword
)
{
public
void
reset
Password
(
Integer
id
,
String
newPassword
)
{
String
sql
=
"update fc_member set password = ? where id = ?"
;
jdbcTemplate
.
executeUpdate
(
sql
,
newPassword
,
id
);
}
...
...
@@ -409,4 +410,15 @@ public class MemberServiceImpl implements MemberService {
jdbcTemplate
.
executeUpdate
(
sql
,
args
);
}
@Override
public
boolean
changePasswordByMemberId
(
Integer
member_id
,
String
password
,
String
newPassword
)
{
Fc_member
member
=
this
.
getMemberById
(
member_id
);
String
encodePassword
=
Common
.
encodePassword
(
password
,
member
.
getSalt
());
if
(
encodePassword
.
equals
(
member
.
getPassword
()))
{
String
encodeNewPassword
=
Common
.
encodePassword
(
newPassword
,
member
.
getSalt
());
return
jdbcTemplate
.
executeUpdate
(
"update fc_member set password = ? where id = ?"
,
encodeNewPassword
,
member
.
getId
())
==
1
;
}
return
false
;
}
}
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