Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xzxt-shiro
Overview
Overview
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
常超
xzxt-shiro
Commits
ed3c6bf2
Commit
ed3c6bf2
authored
Dec 29, 2020
by
caoyin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加从工作桌面(前端)登录的方法
parent
380eb5fe
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
src/main/java/com/xzxtshiro/controller/AccessController.java
+34
-0
No files found.
src/main/java/com/xzxtshiro/controller/AccessController.java
View file @
ed3c6bf2
...
@@ -13,7 +13,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -13,7 +13,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @author liuys
* @author liuys
...
@@ -76,4 +79,35 @@ public class AccessController {
...
@@ -76,4 +79,35 @@ public class AccessController {
return
"logout"
;
return
"logout"
;
}
}
//使用警号登录
@ResponseBody
@RequestMapping
(
value
=
"/loginGzzm"
,
method
=
{
RequestMethod
.
POST
,
RequestMethod
.
GET
})
public
Map
<
String
,
Object
>
loginGzzm
(
HttpServletRequest
request
){
Map
<
String
,
Object
>
returnMap
=
new
HashMap
<>();
SysUser
user
=
new
SysUser
();
String
username
=
request
.
getParameter
(
"username"
);
String
password
=
request
.
getParameter
(
"password"
);
user
.
setUsername
(
username
);
user
.
setPassword
(
password
);
try
{
//用户登录
user
=
TokenUtil
.
login
(
user
,
false
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
returnMap
.
put
(
"state"
,
"error"
);
returnMap
.
put
(
"msg"
,
"登录异常!"
);
return
returnMap
;
}
if
(
user
!=
null
){
request
.
getSession
().
setAttribute
(
"user"
,
user
);
//登录成功生成session
/*request.getSession().setAttribute("perurl",perurl);//权限url 放入session中*/
returnMap
.
put
(
"state"
,
"success"
);
returnMap
.
put
(
"msg"
,
"登陆成功!"
);
}
else
{
returnMap
.
put
(
"state"
,
"failed"
);
returnMap
.
put
(
"msg"
,
"用户名或密码错误!"
);
}
return
returnMap
;
}
}
}
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