Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
member-api
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
曲欣亮
member-api
Commits
e5690dce
Commit
e5690dce
authored
Oct 10, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
f7abffa4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
+7
-5
WebMvcConfig.java
src/main/java/com/egolm/film/config/WebMvcConfig.java
+3
-1
MemberTokenServiceImpl.java
...egolm/film/login/service/impl/MemberTokenServiceImpl.java
+3
-3
UserTokenServiceImpl.java
...m/egolm/film/login/service/impl/UserTokenServiceImpl.java
+1
-1
No files found.
src/main/java/com/egolm/film/config/WebMvcConfig.java
View file @
e5690dce
...
@@ -19,6 +19,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
...
@@ -19,6 +19,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
import
com.egolm.film.config.interceptor.AdminLoginInterceptor
;
import
com.egolm.film.config.interceptor.AdminLoginInterceptor
;
import
com.egolm.film.config.interceptor.LocaleSessionInterceptor
;
import
com.egolm.film.config.interceptor.LocaleSessionInterceptor
;
import
com.egolm.film.config.interceptor.MemberLoginInterceptor
;
import
com.egolm.film.config.interceptor.UserLoginInterceptor
;
import
com.egolm.film.config.interceptor.UserLoginInterceptor
;
@Configuration
@Configuration
...
@@ -31,7 +32,7 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
...
@@ -31,7 +32,7 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
private
UserLoginInterceptor
userLoginInterceptor
;
private
UserLoginInterceptor
userLoginInterceptor
;
@Autowired
@Autowired
private
Us
erLoginInterceptor
memberLoginInterceptor
;
private
Memb
erLoginInterceptor
memberLoginInterceptor
;
@Autowired
@Autowired
private
LocaleSessionInterceptor
localeSessionInterceptor
;
private
LocaleSessionInterceptor
localeSessionInterceptor
;
...
@@ -42,6 +43,7 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
...
@@ -42,6 +43,7 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
registry
.
addInterceptor
(
adminLoginInterceptor
).
addPathPatterns
(
"/admin/**"
).
excludePathPatterns
(
"/admin/login"
);
registry
.
addInterceptor
(
adminLoginInterceptor
).
addPathPatterns
(
"/admin/**"
).
excludePathPatterns
(
"/admin/login"
);
registry
.
addInterceptor
(
userLoginInterceptor
).
addPathPatterns
(
"/user/**"
).
excludePathPatterns
(
"/user/login"
);
registry
.
addInterceptor
(
userLoginInterceptor
).
addPathPatterns
(
"/user/**"
).
excludePathPatterns
(
"/user/login"
);
registry
.
addInterceptor
(
memberLoginInterceptor
).
addPathPatterns
(
"/member/**"
).
excludePathPatterns
(
"/member/login"
);
registry
.
addInterceptor
(
memberLoginInterceptor
).
addPathPatterns
(
"/member/**"
).
excludePathPatterns
(
"/member/login"
);
}
}
@Override
@Override
...
...
src/main/java/com/egolm/film/login/service/impl/MemberTokenServiceImpl.java
View file @
e5690dce
...
@@ -28,9 +28,9 @@ public class MemberTokenServiceImpl implements MemberTokenService {
...
@@ -28,9 +28,9 @@ public class MemberTokenServiceImpl implements MemberTokenService {
@Override
@Override
public
LoginToken
doLogin
(
String
username
,
String
password
)
{
public
LoginToken
doLogin
(
String
username
,
String
password
)
{
HttpSession
session
=
WebMvcConfig
.
getSession
();
HttpSession
session
=
WebMvcConfig
.
getSession
();
String
md5String
=
StringUtil
.
toMD5HexString
(
password
);
String
md5String
=
StringUtil
.
toMD5HexString
(
password
)
.
toLowerCase
()
;
String
loginSql
=
"select * from fc_member where
username = ?
and password = ?"
;
String
loginSql
=
"select * from fc_member where
(username = ? or email = ?)
and password = ?"
;
List
<
Map
<
String
,
Object
>>
list
=
this
.
jdbcTemplate
.
queryForList
(
loginSql
,
username
,
md5String
);
List
<
Map
<
String
,
Object
>>
list
=
this
.
jdbcTemplate
.
queryForList
(
loginSql
,
username
,
username
,
md5String
);
if
(
list
!=
null
)
{
if
(
list
!=
null
)
{
if
(
list
.
size
()
==
1
)
{
if
(
list
.
size
()
==
1
)
{
Map
<
String
,
Object
>
map
=
list
.
get
(
0
);
Map
<
String
,
Object
>
map
=
list
.
get
(
0
);
...
...
src/main/java/com/egolm/film/login/service/impl/UserTokenServiceImpl.java
View file @
e5690dce
...
@@ -24,7 +24,7 @@ public class UserTokenServiceImpl implements UserTokenService {
...
@@ -24,7 +24,7 @@ public class UserTokenServiceImpl implements UserTokenService {
@Override
@Override
public
LoginToken
doLogin
(
String
username
,
String
password
)
{
public
LoginToken
doLogin
(
String
username
,
String
password
)
{
HttpSession
session
=
WebMvcConfig
.
getSession
();
HttpSession
session
=
WebMvcConfig
.
getSession
();
String
md5String
=
StringUtil
.
toMD5HexString
(
password
);
String
md5String
=
StringUtil
.
toMD5HexString
(
password
)
.
toLowerCase
()
;
String
loginSql
=
"select * from fc_user where username = ? and password = ?"
;
String
loginSql
=
"select * from fc_user where username = ? and password = ?"
;
List
<
Map
<
String
,
Object
>>
list
=
this
.
jdbcTemplate
.
queryForList
(
loginSql
,
username
,
md5String
);
List
<
Map
<
String
,
Object
>>
list
=
this
.
jdbcTemplate
.
queryForList
(
loginSql
,
username
,
md5String
);
if
(
list
!=
null
)
{
if
(
list
!=
null
)
{
...
...
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