Merge pull request #1815 from basecamp/fix-ios-login
Allow typing magic links on mobile
This commit is contained in:
@@ -4,16 +4,12 @@ import { onNextEventLoopTick } from "helpers/timing_helpers"
|
|||||||
export default class extends Controller {
|
export default class extends Controller {
|
||||||
static targets = [ "input" ]
|
static targets = [ "input" ]
|
||||||
|
|
||||||
submit(event) {
|
submit() {
|
||||||
onNextEventLoopTick(() => {
|
|
||||||
this.inputTarget.disabled = true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
paste(event) {
|
|
||||||
onNextEventLoopTick(() => {
|
onNextEventLoopTick(() => {
|
||||||
|
if (!this.inputTarget.disabled) {
|
||||||
this.element.submit()
|
this.element.submit()
|
||||||
this.inputTarget.disabled = true
|
this.inputTarget.disabled = true
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<%= form.text_field :code, required: true, class: "input center txt-align-enter txt-large",
|
<%= form.text_field :code, required: true, class: "input center txt-align-enter txt-large",
|
||||||
autofocus: true, autocorrect: "off", autocapitalize: "off", spellcheck: "false", "data-1p-ignore": true,
|
autofocus: true, autocorrect: "off", autocapitalize: "off", spellcheck: "false", "data-1p-ignore": true,
|
||||||
autocomplete: "one-time-code", maxlength: "6", placeholder: "••••••", value: params[:code],
|
autocomplete: "one-time-code", maxlength: "6", placeholder: "••••••", value: params[:code],
|
||||||
data: { magic_link_target: "input", action: "keydown.enter->magic-link#submit paste->magic-link#paste" } %>
|
data: { magic_link_target: "input", action: "keydown.enter->magic-link#submit paste->magic-link#submit" } %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<p class="txt-small">The code you receive will work for <%= distance_of_time_in_words(MagicLink::EXPIRATION_TIME) %>.</p>
|
<p class="txt-small">The code you receive will work for <%= distance_of_time_in_words(MagicLink::EXPIRATION_TIME) %>.</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user