GetAnswer() method changed into Answer().
This commit is contained in:
parent
c6bd1a6185
commit
4b0577f1bd
@ -42,7 +42,7 @@ func (c *DwellingCaptcha) Image(style string) *image.Image {
|
||||
ctx.SetRGB255(0x0a, 0x0a, 0x0a)
|
||||
}
|
||||
ctx.Scale(4.0, 2.7)
|
||||
ctx.DrawStringAnchored(string(c.GetAnswer()), 20, 5, .5, .5)
|
||||
ctx.DrawStringAnchored(string(c.Answer()), 20, 5, .5, .5)
|
||||
|
||||
// draw lines and points
|
||||
h := float64(ctx.Height())
|
||||
|
@ -23,7 +23,7 @@ type Captcha interface {
|
||||
// Image generates and returns an image of captcha.
|
||||
Image(style string) *image.Image
|
||||
// GetAnswer returns a pregenerated answer.
|
||||
GetAnswer() Answer
|
||||
Answer() Answer
|
||||
// Solve compares a stored answer with a passed one.
|
||||
// Sets field Solved to true if they are equal.
|
||||
Solve(answer Answer) bool
|
||||
@ -53,7 +53,7 @@ func (c *BaseCaptcha) Image(style string) *image.Image {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *BaseCaptcha) GetAnswer() Answer {
|
||||
func (c *BaseCaptcha) Answer() Answer {
|
||||
if c.answer == "" {
|
||||
c.answer = NewIntAnswer()
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ func NewInMemoryCaptchaDB(expire time.Duration) *InMemoryCaptchaDB {
|
||||
// `data` string is an additional random data used to generate an ID,
|
||||
// e.g. IP-address.
|
||||
func (cdb *InMemoryCaptchaDB) New(data string, captcha Captcha) (Captcha, ID) {
|
||||
id := NewID(data, captcha.GetAnswer())
|
||||
id := NewID(data, captcha.Answer())
|
||||
|
||||
cdb.Lock()
|
||||
cdb.db[id] = captcha
|
||||
|
Loading…
Reference in New Issue
Block a user