Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
00eac0e4
authored
2014-08-11 21:41:22 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge pull request #729 from francoishill/patch-9
Update captcha.go
2 parents
2773fda8
58ac0d5e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
utils/captcha/captcha.go
utils/captcha/captcha.go
View file @
00eac0e
...
...
@@ -200,7 +200,7 @@ func (c *Captcha) Verify(id string, challenge string) (success bool) {
key
:=
c
.
key
(
id
)
if
v
,
ok
:=
c
.
store
.
Get
(
key
)
.
([]
byte
);
ok
&&
len
(
v
)
==
len
(
challenge
)
{
if
v
,
ok
:=
c
.
store
.
Get
(
key
)
.
([]
byte
);
ok
{
chars
=
v
}
else
{
return
...
...
@@ -211,6 +211,9 @@ func (c *Captcha) Verify(id string, challenge string) (success bool) {
c
.
store
.
Delete
(
key
)
}()
if
len
(
chars
)
!=
len
(
challenge
)
{
return
}
// verify challenge
for
i
,
c
:=
range
chars
{
if
c
!=
challenge
[
i
]
-
48
{
...
...
@@ -221,6 +224,7 @@ func (c *Captcha) Verify(id string, challenge string) (success bool) {
return
true
}
// create a new captcha.Captcha
func
NewCaptcha
(
urlPrefix
string
,
store
cache
.
Cache
)
*
Captcha
{
cpt
:=
&
Captcha
{}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment