Skip to content

Commit

Permalink
Add Next button to verification page
Browse files Browse the repository at this point in the history
  • Loading branch information
yyorkchan committed Jul 9, 2024
1 parent bdc0f79 commit d2098f6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 2 additions & 0 deletions authui/src/authflowv2/otpInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class OtpInputController extends Controller {
this.inputTarget.addEventListener("paste", this.handlePaste);
this.inputTarget.addEventListener("focus", this.handleFocus);
this.inputTarget.addEventListener("blur", this.handleBlur);
this.submitTarget.disabled = true;
// element.selectionchange is NOT the same as document.selectionchange
// element.selectionchange is an experimental technology.
window.document.addEventListener(
Expand Down Expand Up @@ -61,6 +62,7 @@ export class OtpInputController extends Controller {

const reachedMaxDigits = this.value.length === this.maxLength;
if (reachedMaxDigits) {
this.submitTarget.disabled = false;
this.submitTarget.click();
}

Expand Down
20 changes: 11 additions & 9 deletions resources/authgear/templates/en/web/authflowv2/__otp_input.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,6 @@
</div>
{{ end }}

<button
form="{{ $.FormName }}"
class="hidden"
type="submit"
name="{{ or $.SubmitButtonName "x_action" }}"
value="{{ or $.SubmitButtonValue "submit" }}"
data-otp-input-target="submit"
data-authgear-event="{{ $.SubmitEvent }}"
></button>
</div>

{{ if not $.ResendButtonHidden }}
Expand All @@ -90,5 +81,16 @@
</button>
</form>
{{ end }}

<button
form="{{ $.FormName }}"
class="primary-btn w-full"
type="submit"
name="{{ or $.SubmitButtonName "x_action" }}"
value="{{ or $.SubmitButtonValue "submit" }}"
data-otp-input-target="submit"
data-authgear-event="{{ $.SubmitEvent }}"
> Next </button>

</div>
{{ end }}

0 comments on commit d2098f6

Please sign in to comment.