-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mod_auth2fa: add option to force setting 2FA before log on. (#3122)
* mod_auth2fa: add option to force setting 2FA before log on. * Add check for 2fa mode in pw reset form
- Loading branch information
Showing
24 changed files
with
836 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{% with m.auth2fa.user_mode as mode %} | ||
{% if mode == 2 or (mode == 1 and not m.auth2fa.is_totp_requested) %} | ||
{% wire postback={request_2fa} delegate=`mod_auth2fa` %} | ||
{% endif %} | ||
{% endwith %} | ||
{% if not m.auth2fa.is_totp_enabled %} | ||
{% with m.auth2fa.user_mode as mode %} | ||
{% if mode >= 2 or (mode == 1 and not m.auth2fa.is_totp_requested) %} | ||
{% wire postback={request_2fa} delegate=`mod_auth2fa` %} | ||
{% endif %} | ||
{% endwith %} | ||
{% endif %} |
43 changes: 43 additions & 0 deletions
43
modules/mod_auth2fa/templates/_logon_login_set_passcode.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<p>{_ You must set your two-factor authentication passcode now. Next time you sign in you will need to enter the two-factor authentication passcode. _}</p> | ||
<p>{_ Scan the two-factor authentication barcode with an app such as <a href="https://support.google.com/accounts/answer/1066447">Google Authenticator</a> or <a href="https://duo.com/product/trusted-users/two-factor-authentication/duo-mobile">Duo Mobile</a>. _}</p> | ||
|
||
<div style="margin: 50px 0"> | ||
{% with m.auth2fa.new_totp_image_url as totp %} | ||
<p style="text-align: center"> | ||
<img src="{{ totp.url }}" style="width: 200px; height: 200px; max-width: 90%"> | ||
</p> | ||
|
||
<p style="text-align: center"> | ||
<input readonly | ||
type="hidden" | ||
value="{{ totp.secret }}" | ||
name="code-new" | ||
id="{{ #secret }}" | ||
style="text-align: center; border: none;"> | ||
<a class="btn btn-xs btn-default" id="{{ #btn }}"> | ||
<span class="fa fa-copy"></span> {_ Copy _} | ||
</a> | ||
{% wire id=#btn | ||
action={script | ||
script=" | ||
document.getElementById('" ++ #secret ++ "').select(); | ||
document.execCommand('copy'); | ||
" | ||
} | ||
action={growl text=_"Copied to clipboard"} | ||
%} | ||
</p> | ||
{% endwith %} | ||
</div> | ||
|
||
<div class="form-group"> | ||
<p>{_ After you scanned the barcode, please enter the passcode generated by your two-factor authentication app below. _}</p> | ||
|
||
<label for="password" class="control-label">{_ Passcode generated by your app _}</label> | ||
<input class="form-control {% if not is_reset %}do_autofocus{% endif %}" type="text" id="test_passcode" name="test_passcode" value="" autocomplete="one-time-code" placeholder="{_ Two-factor passcode _}" inputmode="numeric" pattern="^[0-9]+$" required> | ||
|
||
{% validate id="test_passcode" | ||
type={presence} | ||
type={format pattern="^[0-9]+$"} | ||
%} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{# This template is only shown iff no passcode entry field is shown. #} | ||
{% if m.config.mod_auth2fa.mode.value == "3" %} | ||
{% include "_logon_login_set_passcode.tpl" is_reset %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.