Skip to content
GitLab
Explore
Sign in
Commits on Source (2)
Add the TOTP login action button the action
· 107e622e
Marco De Donno
authored
Sep 27, 2019
107e622e
Add a error message if the TOTP field is not provided by the login.html page
· 1dd3772b
Marco De Donno
authored
Sep 27, 2019
1dd3772b
Hide whitespace changes
Inline
Side-by-side
module.py
View file @
1dd3772b
...
...
@@ -429,7 +429,13 @@ def do_login():
user
=
config
.
db
.
query_fetchone
(
"
SELECT username, totp FROM users WHERE username = %s
"
,
(
session
[
"
username
"
],
)
)
totp_db
=
pyotp
.
TOTP
(
user
[
"
totp
"
]
)
totp_user
=
request
.
form
[
"
totp
"
]
totp_user
=
request
.
form
.
get
(
"
totp
"
,
None
)
if
totp_user
==
None
:
return
jsonify
(
{
"
error
"
:
True
,
"
message
"
:
"
No TOTP provided
"
}
)
app
.
logger
.
info
(
"
TOTP expected now: {}
"
.
format
(
totp_db
.
now
()
)
)
app
.
logger
.
info
(
"
TOTP provided: {}
"
.
format
(
totp_user
)
)
...
...
templates/login.html
View file @
1dd3772b
...
...
@@ -239,6 +239,12 @@
)
);
$
(
"
#login_button
"
).
on
(
"
click
"
,
function
(
event
)
{
event
.
preventDefault
();
login_action_totp
();
}
);
$
(
"
#totp
"
).
focus
();
}
...
...