1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-04 15:54:48 +01:00

Refactor: move code for obtaining totp tokens to tests/lib/totp.sh

This commit is contained in:
downtownallday
2020-09-10 18:19:29 -04:00
parent c0431474c9
commit 752da93a37
3 changed files with 24 additions and 2 deletions

View File

@@ -195,9 +195,9 @@ mgmt_get_totp_token() {
local count=0
while [ -z "$TOTP_TOKEN" -a $count -lt 10 ]; do
TOTP_TOKEN="$(/usr/local/lib/mailinabox/env/bin/python -c "import pyotp; totp=pyotp.TOTP(r'$secret'); print(totp.now());" 2>>"$TEST_OF")"
TOTP_TOKEN="$(totp_current_token "$secret" 2>>"$TEST_OF")"
if [ $? -ne 0 ]; then
record "Failed: Could not generate a TOTP token !"
record "Failed: Could not get the TOTP token !"
return 1
fi