Fix captcha not refocusing when QR is autohidden and first try is wrong. #635
This commit is contained in:
parent
d0dadd2110
commit
ba1f466e8f
@ -95,7 +95,9 @@ Captcha.v1 =
|
|||||||
setup: (focus, force) ->
|
setup: (focus, force) ->
|
||||||
return unless @isEnabled and (force or @needed())
|
return unless @isEnabled and (force or @needed())
|
||||||
@create()
|
@create()
|
||||||
@nodes.input.focus() if focus
|
if focus
|
||||||
|
$.addClass QR.nodes.el, 'focus'
|
||||||
|
@nodes.input.focus()
|
||||||
|
|
||||||
afterSetup: ->
|
afterSetup: ->
|
||||||
return unless challenge = $.id 'recaptcha_challenge_field_holder'
|
return unless challenge = $.id 'recaptcha_challenge_field_holder'
|
||||||
|
|||||||
@ -73,7 +73,11 @@ Captcha.v2 =
|
|||||||
|
|
||||||
setup: (focus, force) ->
|
setup: (focus, force) ->
|
||||||
return unless @isEnabled and (@needed() or force)
|
return unless @isEnabled and (@needed() or force)
|
||||||
@nodes.counter.focus() if focus
|
|
||||||
|
if focus
|
||||||
|
$.addClass QR.nodes.el, 'focus'
|
||||||
|
@nodes.counter.focus()
|
||||||
|
|
||||||
if @timeouts.destroy
|
if @timeouts.destroy
|
||||||
clearTimeout @timeouts.destroy
|
clearTimeout @timeouts.destroy
|
||||||
delete @timeouts.destroy
|
delete @timeouts.destroy
|
||||||
|
|||||||
@ -769,7 +769,7 @@ QR =
|
|||||||
QR.cooldown.addDelay post, seconds
|
QR.cooldown.addDelay post, seconds
|
||||||
else # stop auto-posting
|
else # stop auto-posting
|
||||||
QR.cooldown.auto = false
|
QR.cooldown.auto = false
|
||||||
QR.captcha.setup(QR.cooldown.auto and d.activeElement is QR.nodes.status)
|
QR.captcha.setup(QR.cooldown.auto and d.activeElement in [QR.nodes.status, d.body])
|
||||||
QR.cooldown.auto = false if QR.captcha.isEnabled and !QR.captcha.captchas.length
|
QR.cooldown.auto = false if QR.captcha.isEnabled and !QR.captcha.captchas.length
|
||||||
QR.status()
|
QR.status()
|
||||||
QR.error err
|
QR.error err
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user