aboutsummaryrefslogtreecommitdiffstats
path: root/templates/web/base
diff options
context:
space:
mode:
Diffstat (limited to 'templates/web/base')
-rw-r--r--templates/web/base/auth/_username_error.html13
-rw-r--r--templates/web/base/auth/change_phone.html10
-rw-r--r--templates/web/base/auth/general.html15
3 files changed, 16 insertions, 22 deletions
diff --git a/templates/web/base/auth/_username_error.html b/templates/web/base/auth/_username_error.html
new file mode 100644
index 000000000..c0ddc135a
--- /dev/null
+++ b/templates/web/base/auth/_username_error.html
@@ -0,0 +1,13 @@
+[% IF username_error;
+ # other keys include fqdn, mxcheck if you'd like to write a custom error message
+ errors = {
+ nonmobile = loc('Please enter a mobile number'),
+ sms_failed = tprintf(loc('Sending a confirmation text failed: "%s"'), sms_error),
+ missing_phone = loc('Please enter your phone number'),
+ other_phone = loc('Please check your phone number is correct'),
+ missing_email = loc('Please enter your email'),
+ other_email = loc('Please check your email address is correct')
+ };
+ default = "other_$default";
+ errors.$username_error || errors.$default;
+END ~%]
diff --git a/templates/web/base/auth/change_phone.html b/templates/web/base/auth/change_phone.html
index 4b181f6c5..27a2f63dd 100644
--- a/templates/web/base/auth/change_phone.html
+++ b/templates/web/base/auth/change_phone.html
@@ -25,14 +25,8 @@ END
<input type="hidden" name="token" value="[% csrf_token %]">
<fieldset>
- [% IF username_error;
- errors = {
- nonmobile = loc('Please enter a mobile number'),
- missing_phone = loc('Please enter your phone number'),
- other_phone = loc('Please check your phone number is correct')
- };
- loc_username_error = errors.$username_error || errors.other_phone;
- %]
+ [% loc_username_error = INCLUDE 'auth/_username_error.html' default='phone' %]
+ [% IF loc_username_error %]
<div class="form-error">[% loc_username_error %]</div>
[% END %]
diff --git a/templates/web/base/auth/general.html b/templates/web/base/auth/general.html
index e64230b41..d630dd415 100644
--- a/templates/web/base/auth/general.html
+++ b/templates/web/base/auth/general.html
@@ -36,20 +36,7 @@
<div id="js-social-email-hide">
[% END %]
- [% IF username_error;
-
- # other keys include fqdn, mxcheck if you'd like to write a custom error message
-
- errors = {
- nonmobile = loc('Please enter a mobile number'),
- missing_email = loc('Please enter your email'),
- other_email = loc('Please check your email address is correct')
- missing_phone = loc('Please enter your phone number'),
- other_phone = loc('Please check your phone number is correct')
- };
-
- loc_username_error = errors.$username_error || errors.other_email;
- END %]
+ [% loc_username_error = INCLUDE 'auth/_username_error.html' default='email' %]
[% IF c.config.SMS_AUTHENTICATION %]
[% SET username_label = loc('Your email or mobile') %]