Fix cached captchas causing errors when we switch between captcha types.
This commit is contained in:
parent
cd720e7f29
commit
9407af1f65
@ -133,7 +133,7 @@ Captcha.noscript =
|
||||
if captcha = @captchas.shift()
|
||||
@count()
|
||||
$.set 'captchas', @captchas
|
||||
{challenge: captcha.response, response: 'manual_challenge'}
|
||||
captcha
|
||||
else if /\S/.test @nodes.input.value
|
||||
(cb) =>
|
||||
@submitCB = cb
|
||||
@ -149,15 +149,17 @@ Captcha.noscript =
|
||||
save: (token) ->
|
||||
delete @occupied
|
||||
@nodes.input.value = ''
|
||||
captcha =
|
||||
challenge: token
|
||||
response: 'manual_challenge'
|
||||
timeout: @timeout
|
||||
if @submitCB
|
||||
@submitCB {challenge: token, response: 'manual_challenge'}
|
||||
@submitCB captcha
|
||||
delete @submitCB
|
||||
if @needed() then @reload() else @destroy()
|
||||
else
|
||||
$.forceSync 'captchas'
|
||||
@captchas.push
|
||||
response: token
|
||||
timeout: @timeout
|
||||
@captchas.push captcha
|
||||
@count()
|
||||
$.set 'captchas', @captchas
|
||||
@reload()
|
||||
|
||||
@ -135,16 +135,17 @@ Captcha.v1 =
|
||||
getOne: ->
|
||||
@clear()
|
||||
if captcha = @captchas.shift()
|
||||
{challenge, response} = captcha
|
||||
@count()
|
||||
$.set 'captchas', @captchas
|
||||
captcha
|
||||
else
|
||||
challenge = @nodes.img.alt
|
||||
challenge = @nodes.img.alt
|
||||
timeout = @timeout
|
||||
if /\S/.test(response = @nodes.input.value)
|
||||
@destroy()
|
||||
{challenge, response, timeout}
|
||||
else
|
||||
return null
|
||||
{challenge, response}
|
||||
null
|
||||
|
||||
save: ->
|
||||
return unless /\S/.test(response = @nodes.input.value)
|
||||
|
||||
@ -169,7 +169,7 @@ Captcha.v2 =
|
||||
if captcha = @captchas.shift()
|
||||
$.set 'captchas', @captchas
|
||||
@count()
|
||||
captcha.response
|
||||
captcha
|
||||
else
|
||||
null
|
||||
|
||||
|
||||
@ -680,7 +680,7 @@ QR =
|
||||
extra.form.append 'recaptcha_challenge_field', response.challenge
|
||||
extra.form.append 'recaptcha_response_field', response.response
|
||||
else
|
||||
extra.form.append 'g-recaptcha-response', response
|
||||
extra.form.append 'g-recaptcha-response', response.response
|
||||
QR.req = $.ajax "https://sys.4chan.org/#{g.BOARD}/post", options, extra
|
||||
QR.req.progress = '...'
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user