Don't use v1 cached captchas for new threads. #1300
This commit is contained in:
parent
d7287b5185
commit
73c8054b64
@ -21,9 +21,11 @@ Captcha.cache =
|
|||||||
@captchas = captchas
|
@captchas = captchas
|
||||||
@count()
|
@count()
|
||||||
|
|
||||||
getOne: ->
|
getOne: (isReply) ->
|
||||||
@clear()
|
@clear()
|
||||||
if (captcha = @captchas.shift())
|
i = @captchas.findIndex((x) -> isReply or !x.challenge?)
|
||||||
|
if i >= 0
|
||||||
|
captcha = @captchas.splice(i, 1)[0]
|
||||||
$.set 'captchas', @captchas
|
$.set 'captchas', @captchas
|
||||||
@count()
|
@count()
|
||||||
captcha
|
captcha
|
||||||
|
|||||||
@ -134,8 +134,8 @@ Captcha.v1 =
|
|||||||
delete @occupied
|
delete @occupied
|
||||||
@beforeSetup() if @nodes
|
@beforeSetup() if @nodes
|
||||||
|
|
||||||
getOne: ->
|
getOne: (isReply) ->
|
||||||
if (captcha = Captcha.cache.getOne())
|
if (captcha = Captcha.cache.getOne isReply)
|
||||||
captcha
|
captcha
|
||||||
else
|
else
|
||||||
challenge = @nodes.img.alt
|
challenge = @nodes.img.alt
|
||||||
|
|||||||
@ -153,8 +153,8 @@ Captcha.v2 =
|
|||||||
$.rm node
|
$.rm node
|
||||||
return
|
return
|
||||||
|
|
||||||
getOne: ->
|
getOne: (isReply) ->
|
||||||
Captcha.cache.getOne()
|
Captcha.cache.getOne isReply
|
||||||
|
|
||||||
save: (pasted, token) ->
|
save: (pasted, token) ->
|
||||||
Captcha.cache.save
|
Captcha.cache.save
|
||||||
|
|||||||
@ -621,7 +621,7 @@ QR =
|
|||||||
err or= 'Original comment required.'
|
err or= 'Original comment required.'
|
||||||
|
|
||||||
if QR.captcha.isEnabled and !err
|
if QR.captcha.isEnabled and !err
|
||||||
captcha = QR.captcha.getOne()
|
captcha = QR.captcha.getOne(!!threadID)
|
||||||
unless captcha
|
unless captcha
|
||||||
err = 'No valid captcha.'
|
err = 'No valid captcha.'
|
||||||
QR.captcha.setup(!QR.cooldown.auto or d.activeElement is QR.nodes.status)
|
QR.captcha.setup(!QR.cooldown.auto or d.activeElement is QR.nodes.status)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user