Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lichenggang
/
web_log
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ee221d82
authored
Dec 25, 2020
by
lzzzzl
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
新增登录校验
parent
a157592d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
code/login.go
code/login.go
View file @
ee221d82
...
...
@@ -36,21 +36,21 @@ func VerifyUser(name string, pwd string) (result bool, msg string) {
token
:=
GenerateRandomString
(
32
)
fmt
.
Println
(
token
)
sessionIdMap
[
token
]
=
name
return
ok
,
"存在用户,密码正确"
return
true
,
token
}
else
{
return
!
ok
,
"存在用户,密码不正确"
return
false
,
"存在用户,密码不正确"
}
}
else
{
return
!
ok
,
"不存在用户"
return
false
,
"不存在用户"
}
}
// 验证sessionID
func
VerifySessionID
(
sessionID
string
)
(
bool
,
string
)
{
if
_
,
ok
:=
sessionIdMap
[
sessionID
];
ok
{
return
ok
,
fmt
.
Sprintf
(
"sessionID: %s 存在"
,
sessionID
)
return
true
,
fmt
.
Sprintf
(
"sessionID: %s 存在"
,
sessionID
)
}
else
{
return
!
ok
,
fmt
.
Sprintf
(
"sessionID: %s 不存在"
,
sessionID
)
return
false
,
fmt
.
Sprintf
(
"sessionID: %s 不存在"
,
sessionID
)
}
}
...
...
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