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
8d0cfc7f
Commit
8d0cfc7f
authored
Oct 11, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
04e05577
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
11 deletions
+9
-11
MemberOpenApiController.java
...main/java/com/egolm/film/api/MemberOpenApiController.java
+2
-2
MemberService.java
...java/com/egolm/film/api/member/service/MemberService.java
+0
-2
MemberServiceImpl.java
...egolm/film/api/member/service/impl/MemberServiceImpl.java
+0
-6
Common.java
src/main/java/com/egolm/film/config/Common.java
+5
-0
MemberTokenServiceImpl.java
...egolm/film/login/service/impl/MemberTokenServiceImpl.java
+2
-1
No files found.
src/main/java/com/egolm/film/api/MemberOpenApiController.java
View file @
8d0cfc7f
...
...
@@ -52,7 +52,7 @@ public class MemberOpenApiController {
public
Object
register
(
HttpServletRequest
request
,
String
username
,
String
password
,
String
email
)
{
Locale
locale
=
LocaleContextHolder
.
getLocale
();
String
salt
=
Common
.
getGenerateString
(
6
);
String
encodePwd
=
memberService
.
encodePassword
(
salt
,
password
);
String
encodePwd
=
Common
.
encodePassword
(
password
,
salt
);
Fc_member
member
=
new
Fc_member
();
member
.
setSalt
(
salt
);
member
.
setUsername
(
username
);
...
...
@@ -74,7 +74,7 @@ public class MemberOpenApiController {
int
code
=
(
int
)
((
Math
.
random
()
*
9
+
1
)
*
10000000
);
String
password
=
String
.
valueOf
(
code
);
Fc_member
member
=
memberService
.
getMemberByEmail
(
email
);
String
encodePwd
=
memberService
.
encodePassword
(
member
.
getSalt
(),
password
);
String
encodePwd
=
Common
.
encodePassword
(
password
,
member
.
getSalt
()
);
memberService
.
changePassword
(
member
.
getId
(),
encodePwd
);
String
name
=
member
.
getUsername
();
String
subject
=
messages
.
get
(
"email.getPassword.subject"
);
...
...
src/main/java/com/egolm/film/api/member/service/MemberService.java
View file @
8d0cfc7f
...
...
@@ -7,8 +7,6 @@ import com.egolm.film.bean.Fc_member;
public
interface
MemberService
{
String
encodePassword
(
String
salt
,
String
password
);
Fc_member
getMemberByEmail
(
String
email
);
void
changePassword
(
Integer
id
,
String
newPassword
);
...
...
src/main/java/com/egolm/film/api/member/service/impl/MemberServiceImpl.java
View file @
8d0cfc7f
...
...
@@ -6,7 +6,6 @@ import java.util.Map;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.film.api.member.service.MemberService
;
import
com.egolm.film.bean.Fc_member
;
...
...
@@ -30,11 +29,6 @@ public class MemberServiceImpl implements MemberService {
return
jdbcTemplate
.
queryForBean
(
sql
,
Fc_member
.
class
,
email
);
}
@Override
public
String
encodePassword
(
String
salt
,
String
password
)
{
return
StringUtil
.
toMD5HexString
(
StringUtil
.
toMD5HexString
(
password
+
salt
).
toLowerCase
().
substring
(
4
,
24
)).
toLowerCase
();
}
@Override
public
void
saveMember
(
Fc_member
member
)
{
jdbcTemplate
.
save
(
member
);
...
...
src/main/java/com/egolm/film/config/Common.java
View file @
8d0cfc7f
...
...
@@ -2,6 +2,8 @@ package com.egolm.film.config;
import
java.util.Random
;
import
com.egolm.common.StringUtil
;
public
class
Common
{
public
static
final
String
SOURCES
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"
;
...
...
@@ -19,4 +21,7 @@ public class Common {
System
.
out
.
println
(
getGenerateString
(
8
));
}
public
static
String
encodePassword
(
String
password
,
String
salt
)
{
return
StringUtil
.
toMD5HexString
(
StringUtil
.
toMD5HexString
(
password
+
salt
).
toLowerCase
().
substring
(
4
,
24
)).
toLowerCase
();
}
}
src/main/java/com/egolm/film/login/service/impl/MemberTokenServiceImpl.java
View file @
8d0cfc7f
...
...
@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
import
com.egolm.film.api.member.service.MemberService
;
import
com.egolm.film.bean.Fc_member
;
import
com.egolm.film.common.Messages
;
import
com.egolm.film.config.Common
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.login.service.MemberTokenService
;
...
...
@@ -30,7 +31,7 @@ public class MemberTokenServiceImpl implements MemberTokenService {
if
(
state
==
1
)
{
String
salt
=
member
.
getSalt
();
String
dbPwd
=
member
.
getPassword
();
String
encodePassword
=
memberService
.
encodePassword
(
salt
,
password
);
String
encodePassword
=
Common
.
encodePassword
(
password
,
salt
);
if
(
encodePassword
.
equals
(
dbPwd
))
{
Integer
id
=
member
.
getId
();
LoginToken
token
=
new
LoginToken
(
id
);
...
...
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