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
83623800
Commit
83623800
authored
Nov 20, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后台登陆
parent
1f1e1c3d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
17 deletions
+23
-17
AdminTokenServiceImpl.java
...lm/film/api/admin/service/impl/AdminTokenServiceImpl.java
+22
-16
Common.java
src/main/java/com/egolm/film/util/Common.java
+1
-1
No files found.
src/main/java/com/egolm/film/api/admin/service/impl/AdminTokenServiceImpl.java
View file @
83623800
...
...
@@ -9,12 +9,12 @@ import javax.servlet.http.HttpSession;
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.admin.service.AdminTokenService
;
import
com.egolm.film.config.WebMvcConfig
;
import
com.egolm.film.config.XException
;
import
com.egolm.film.model.LoginToken
;
import
com.egolm.film.util.Common
;
@Service
public
class
AdminTokenServiceImpl
implements
AdminTokenService
{
...
...
@@ -25,13 +25,16 @@ public class AdminTokenServiceImpl implements AdminTokenService {
@Override
public
LoginToken
doLogin
(
String
username
,
String
password
)
{
HttpSession
session
=
WebMvcConfig
.
getSession
();
String
md5String
=
StringUtil
.
toMD5HexString
(
password
).
toLowerCase
();
String
loginSql
=
"select * from fc_admin where username = ? and password = ?"
;
List
<
Map
<
String
,
Object
>>
list
=
this
.
jdbcTemplate
.
queryForList
(
loginSql
,
username
,
md5String
);
String
loginSql
=
"select * from fc_admin where username = ?"
;
List
<
Map
<
String
,
Object
>>
list
=
this
.
jdbcTemplate
.
queryForList
(
loginSql
,
username
);
if
(
list
!=
null
)
{
if
(
list
.
size
()
==
1
)
{
Map
<
String
,
Object
>
map
=
list
.
get
(
0
);
Integer
state
=
(
Integer
)
map
.
get
(
"state"
);
String
salt
=
(
String
)
map
.
get
(
"salt"
);
String
pwd
=
(
String
)
map
.
get
(
"password"
);
String
encodePassword
=
Common
.
encodePassword
(
password
,
salt
);
if
(
encodePassword
.
equals
(
pwd
))
{
if
(
state
==
1
)
{
Integer
adminid
=
(
Integer
)
map
.
get
(
"adminid"
);
LoginToken
token
=
new
LoginToken
(
adminid
);
...
...
@@ -47,6 +50,9 @@ public class AdminTokenServiceImpl implements AdminTokenService {
}
else
{
throw
new
XException
(
"用户状态未知"
);
}
}
else
{
throw
new
XException
(
"用户名或密码错误"
);
}
}
else
if
(
list
.
size
()
==
0
)
{
throw
new
XException
(
"用户名或密码错误"
);
}
else
{
...
...
src/main/java/com/egolm/film/util/Common.java
View file @
83623800
...
...
@@ -22,7 +22,7 @@ public class Common {
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
encodePassword
(
"123456"
,
"
5e0vt0
"
));
System
.
out
.
println
(
encodePassword
(
"123456"
,
"
78hzar
"
));
System
.
out
.
println
(
getGenerateString
(
6
));
}
...
...
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