Commit 0d0b335db5089897cf864f260a95408e99501292

Thomas de Grivel 2022-02-22T06:10:30

fix totp enrolment

diff --git a/assets/css/app.scss b/assets/css/app.scss
index cf6b0c6..7cfab0b 100644
--- a/assets/css/app.scss
+++ b/assets/css/app.scss
@@ -106,7 +106,7 @@ pre.admin_ssh_keys {
 img.qrcode {
     width: 50%;
     min-width: 190px;
-    max-width: 512px;
+    max-width: 256px;
     margin: auto;
     display: block;
 }
diff --git a/lib/kmxgit_web/controllers/user_session_controller.ex b/lib/kmxgit_web/controllers/user_session_controller.ex
index 6e77057..0ba4901 100644
--- a/lib/kmxgit_web/controllers/user_session_controller.ex
+++ b/lib/kmxgit_web/controllers/user_session_controller.ex
@@ -18,7 +18,7 @@ defmodule KmxgitWeb.UserSessionController do
       %{"login" => login, "password" => password} = user_params
       UserManager.get_user_by_login_and_password(login, password)
     end
-    totp = user_params["totp"]
+    totp = user_params["totp_last"]
     if user do
       if user.totp_last == 0 || totp && UserManager.verify_user_totp(user, totp) do
         UserAuth.log_in_user(conn, user, user_params)
diff --git a/lib/kmxgit_web/templates/user/totp.html.heex b/lib/kmxgit_web/templates/user/totp.html.heex
index 1369f29..a81a4f8 100644
--- a/lib/kmxgit_web/templates/user/totp.html.heex
+++ b/lib/kmxgit_web/templates/user/totp.html.heex
@@ -5,9 +5,9 @@
 
   <%= form_for @changeset, Routes.user_path(@conn, :totp_update, User.login(@user)), fn f -> %>
     <div class="mb-3">
-      <%= label f, :otp_last, gettext("Token"), class: "form-label" %>
-      <%= number_input f, :otp_last, class: "form-control" %>
-      <%= error_tag f, :otp_last %>
+      <%= label f, :totp_last, gettext("Token"), class: "form-label" %>
+      <%= number_input f, :totp_last, class: "form-control" %>
+      <%= error_tag f, :totp_last %>
     </div>
 
     <div class="mb-3">
diff --git a/priv/static/_assets/app.css b/priv/static/_assets/app.css
index bfc254a..7a5076d 100644
--- a/priv/static/_assets/app.css
+++ b/priv/static/_assets/app.css
@@ -31047,7 +31047,7 @@ pre.admin_ssh_keys {
 img.qrcode {
   width: 50%;
   min-width: 190px;
-  max-width: 512px;
+  max-width: 256px;
   margin: auto;
   display: block;
 }