gui-init: update $TOTP after generating new secret or resetting TPM

After updating/flashing a new ROM, a new TOTP secret must be generated,
but the $TOTP variable needs to be updated afterwards, otherwise it
will show the previous failure which led to the new secret being
created.

Fix this by re-calling update_totp() after generating a new secret
or resetting the TPM.

Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
This commit is contained in:
Matt DeVillier 2021-09-29 16:32:18 -05:00 committed by tlaurion
parent 5746b8c970
commit 1c6f623c25

View File

@ -170,14 +170,14 @@ update_totp()
g )
if (whiptail $BG_COLOR_WARNING --title 'Generate new TOTP/HOTP secret' \
--yesno "This will erase your old secret and replace it with a new one!\n\nDo you want to proceed?" 16 90) then
generate_totp_htop && BG_COLOR_MAIN_MENU=""
generate_totp_htop && update_totp && BG_COLOR_MAIN_MENU=""
fi
;;
i )
return 1
;;
p )
reset_tpm && BG_COLOR_MAIN_MENU=""
reset_tpm && update_totp && BG_COLOR_MAIN_MENU=""
;;
x )
recovery "User requested recovery shell"