feat: Add SMS country code selector to SMT OTP (LoginV1) (#11373)

<!--
Please inform yourself about the contribution guidelines on submitting a
PR here:
https://github.com/zitadel/zitadel/blob/main/CONTRIBUTING.md#submit-a-pull-request-pr.
Take note of how PR/commit titles should be written and replace the
template texts in the sections below. Don't remove any of the sections.
It is important that the commit history clearly shows what is changed
and why.
Important: By submitting a contribution you agree to the terms from our
Licensing Policy as described here:
https://github.com/zitadel/zitadel/blob/main/LICENSING.md#community-contributions.
-->

# Which Problems Are Solved

- This adds rudimentary country code handling for LoginV1 SMS OTP
- Previously defaulting to CH with no prompt to user causing e.g UK
(+44) based numbers to be re-routed to CH. (+41)

# Additional Context

- Support for SMS OTP is not complete for LoginV2 (according to latest
support email)

Tested with Twilio on both UK + DE # . Appears to work. 

- Closes #8891 

<img width="544" height="485" alt="image"
src="https://github.com/user-attachments/assets/84d31bd8-8863-465f-8860-b51602439dfb"
/>

<img width="858" height="1298" alt="Screenshot 2026-01-16 at 11 23 22"
src="https://github.com/user-attachments/assets/4bf16f0b-2fec-4d63-95b0-f0b73f3a131a"
/>

---------

Co-authored-by: Livio Spring <[email protected]>
Co-authored-by: Silvan <[email protected]>
This commit is contained in:
Guy Sleigh
2026-01-22 06:47:54 +00:00
committed by GitHub
co-authored by Livio Spring Silvan
parent 30d91cde58
commit 597f385ca4
25 changed files with 241 additions and 27 deletions
@@ -22,15 +22,24 @@
<div class="fields">
{{if .Edit}}
<div class="field">
<label class="lgn-label" for="countryCode">{{t "InitMFAOTPSMS.CountryCodeLabel"}}</label>
<select class="lgn-input" id="countryCode" name="countryCode" required>
{{range .CountryCodes}}
<option value="{{.ISOCode}}" {{if eq .ISOCode $.CountryCode}}selected{{end}}>{{.Name}} ({{.CallingCode}})</option>
{{end}}
</select>
</div>
<div class="field">
<label class="lgn-label" for="newPhone">{{t "InitMFAOTPSMS.PhoneLabel"}}</label>
<input class="lgn-input" type="tel" id="newPhone" name="newPhone" autocomplete="off" value="{{.Phone}}" autofocus required>
</div>
{{else}}
<input type="hidden" name="countryCode" value="{{ .CountryCode }}" />
<div class="field lgn-actions">
<p>{{.Phone}}</p>
<span class="fill-space"></span>
<button type="button" id="edit" name="edit" value="true" class="lgn-stroked-button" formnovalidate>{{t "InitMFAOTPSMS.EditButtonText"}}</button>
<button type="submit" id="edit" name="edit" value="true" class="lgn-stroked-button" formnovalidate>{{t "InitMFAOTPSMS.EditButtonText"}}</button>
</div>
{{end}}
{{if and .Phone (not .Edit) }}