diff options
author | Ivan Kohler <ivan@freeside.biz> | 2022-09-07 17:22:51 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2022-09-07 17:22:51 -0700 |
commit | 26ddb940ad27ce8ac5e87084eeed857a390987bc (patch) | |
tree | 3d6e1c46d8d703a1c6bb63820ab741d6a67ab506 /httemplate/pref | |
parent | 691de38ac2ca6c54b37feb50e1332bab6268773f (diff) |
google authenticator support, RT#86743
Diffstat (limited to 'httemplate/pref')
-rw-r--r-- | httemplate/pref/pref.html | 12 | ||||
-rw-r--r-- | httemplate/pref/set_totp_secret32.html | 19 |
2 files changed, 31 insertions, 0 deletions
diff --git a/httemplate/pref/pref.html b/httemplate/pref/pref.html index 56fde6d44..5f68d3e46 100644 --- a/httemplate/pref/pref.html +++ b/httemplate/pref/pref.html @@ -29,6 +29,18 @@ </TABLE> <BR> + <FONT CLASS="fsinnerbox-title"><% emt('Google Authenticator') %></FONT> + <TABLE CLASS="fsinnerbox"> + <TR> +% if ( $curuser->totp_secret32 ) { + <TD><IMG SRC="<% $curuser->totp_qr_code_url %>"</IMG></TD> +% } else { + <TD><A HREF="<%$p%>pref/set_totp_secret32.html">Enable</A></TD> +% } + </TR> + </TABLE> + <BR> + % } <FONT CLASS="fsinnerbox-title"><% emt("Interface") %></FONT> diff --git a/httemplate/pref/set_totp_secret32.html b/httemplate/pref/set_totp_secret32.html new file mode 100644 index 000000000..f5676bc38 --- /dev/null +++ b/httemplate/pref/set_totp_secret32.html @@ -0,0 +1,19 @@ +<& /elements/header.html, mt('Google Authenticator for [_1]', $FS::CurrentUser::CurrentUser->username) &> + +Scan this code with the Google Authenticator application on your phone. +<BR><BR> + +<IMG SRC="<% $access_user->totp_qr_code_url %>"></IMG> +<BR><BR> + +Future logins will require a 6-digit code generated by the application. + +<& /elements/footer.html &> +<%init> + +my $access_user = $FS::CurrentUser::CurrentUser; + +my $error = $access_user->set_totp_secret32 unless length($access_user->totp_secret32); +die $error if $error; #better error handling for this "shouldn't happen" case? + +</%init> |