diff --git a/src/appier_extras/parts/admin/part.py b/src/appier_extras/parts/admin/part.py index 1f929def..9b422492 100644 --- a/src/appier_extras/parts/admin/part.py +++ b/src/appier_extras/parts/admin/part.py @@ -200,6 +200,7 @@ def routes(self): (("GET",), "/admin/2fa", self.two_factor), (("GET",), "/admin/otp", self.otp), (("POST",), "/admin/otp", self.otp_login), + (("GET",), "/admin/otp/register", self.otp_register), (("GET",), "/admin/fido2", self.fido2), (("POST",), "/admin/fido2", self.fido2_login), (("GET",), "/admin/fido2/register", self.fido2_register), @@ -742,6 +743,14 @@ def otp_login(self): # alternative to the root index of the administration return self.redirect(next or self.url_for(self.owner.admin_login_redirect)) + def otp_register(self): + next = self.field("next") + + account = self.account_c.from_session() + account.generate_otp_s() + + return self.template("otp_register.html.tpl", next=next) + def fido2(self): next = self.field("next") error = self.field("error") diff --git a/src/appier_extras/parts/admin/static/css/layout.css b/src/appier_extras/parts/admin/static/css/layout.css index 735e3d46..48ebb154 100644 --- a/src/appier_extras/parts/admin/static/css/layout.css +++ b/src/appier_extras/parts/admin/static/css/layout.css @@ -424,6 +424,10 @@ body.mobile-s .pages > .page.other { margin: 0px auto 0px auto; } +.otp-qrcode { + max-width: 200px; +} + .fido2-register { display: none; } diff --git a/src/appier_extras/parts/admin/templates/fluid/account/show.html.tpl b/src/appier_extras/parts/admin/templates/fluid/account/show.html.tpl index f78681c1..cd1ba01f 100644 --- a/src/appier_extras/parts/admin/templates/fluid/account/show.html.tpl +++ b/src/appier_extras/parts/admin/templates/fluid/account/show.html.tpl @@ -5,6 +5,9 @@ {% block buttons %} {{ super() }}