generateAnswer() function made into a private. And now being called by GetAnswer() method in Captcha.
This commit is contained in:
parent
10167c4e17
commit
9ed5ad42e2
@ -68,6 +68,9 @@ func (c *Captcha) Solve(answer Answer) bool {
|
||||
}
|
||||
|
||||
func (c *Captcha) GetAnswer() Answer {
|
||||
if c.Answer == "" {
|
||||
c.Answer = generateAnswer()
|
||||
}
|
||||
return c.Answer
|
||||
}
|
||||
|
||||
@ -79,7 +82,7 @@ func (c *Captcha) Expiry() time.Time {
|
||||
return c.ExpireIn
|
||||
}
|
||||
|
||||
func GenerateAnswer() Answer {
|
||||
func generateAnswer() Answer {
|
||||
ans, _ := rand.Int(rand.Reader, big.NewInt(maxAnswer))
|
||||
return (Answer(ans.String()))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user