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
840fd3b6
authored
2015-03-30 21:40:57 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge pull request #1083 from supiyun/patch-1
验证码reload问题
2 parents
eedaea2f
2d26f7df
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
utils/captcha/captcha.go
utils/captcha/captcha.go
View file @
840fd3b
...
...
@@ -132,15 +132,6 @@ func (c *Captcha) Handler(ctx *context.Context) {
key
:=
c
.
key
(
id
)
if
v
,
ok
:=
c
.
store
.
Get
(
key
)
.
([]
byte
);
ok
{
chars
=
v
}
else
{
ctx
.
Output
.
SetStatus
(
404
)
ctx
.
WriteString
(
"captcha not found"
)
return
}
// reload captcha
if
len
(
ctx
.
Input
.
Query
(
"reload"
))
>
0
{
chars
=
c
.
genRandChars
()
if
err
:=
c
.
store
.
Put
(
key
,
chars
,
c
.
Expiration
);
err
!=
nil
{
...
...
@@ -149,6 +140,14 @@ func (c *Captcha) Handler(ctx *context.Context) {
beego
.
Error
(
"Reload Create Captcha Error:"
,
err
)
return
}
}
else
{
if
v
,
ok
:=
c
.
store
.
Get
(
key
)
.
([]
byte
);
ok
{
chars
=
v
}
else
{
ctx
.
Output
.
SetStatus
(
404
)
ctx
.
WriteString
(
"captcha not found"
)
return
}
}
img
:=
NewImage
(
chars
,
c
.
StdWidth
,
c
.
StdHeight
)
...
...
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