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