Skip to content
Snippets Groups Projects
Verified Commit ff414181 authored by ornanovitch's avatar ornanovitch
Browse files

more future proof design

parent 506a6c87
No related branches found
No related tags found
No related merge requests found
......@@ -58,7 +58,8 @@ def totp_setup():
auth = models.Auth(models.Auth.TOTP)
auth.set_otp_key()
user.auths[models.Auth.TOTP] = auth
models.log(models.History.ENABLE_MFA, user=flask_login.current_user)
models.log(models.History.MFA, comment=str(_("2FA has been enabled")),
user=flask_login.current_user)
models.db.session.add(auth)
models.db.session.commit()
flask.flash(_("Successfully setup 2FA"), "success")
......@@ -71,7 +72,8 @@ def totp_setup():
def totp_delete():
user = flask_login.current_user
auth = user.auths[models.Auth.TOTP]
models.log(models.History.DISABLE_MFA, user=flask_login.current_user)
models.log(models.History.MFA, comment=str(_("2FA has been disabled")),
user=flask_login.current_user)
models.db.session.delete(auth)
models.db.session.commit()
flask.flash(_("Successfully disabled 2FA"), "success")
......
......@@ -330,15 +330,13 @@ class History(db.Model):
STATUS = "status"
TRANSITION = "transition"
PASSWORD = "password"
ENABLE_MFA = "enable 2fa"
DISABLE_MFA = "disable 2fa"
MFA = "mfa"
DESCRIPTION = {
SIGNUP: _("signed up for this account"),
CREATE: _("created the profile {this.profile.username} on {this.service.name}"),
PASSWORD: _("changed this account password"),
ENABLE_MFA: _("enabled this account two-factor authentication (2FA) settings"),
DISABLE_MFA: _("disabled this account two-factor authentication (2FA) settings"),
MFA: _("modified this account multi-factor authentication (MFA) setting"),
STATUS: _("set the {this.service.name} profile {this.profile.username} as {this.value}"),
TRANSITION: _("did {this.transition.label} the profile {this.profile.username} on {this.service.name}")
}
......
......@@ -18,7 +18,7 @@
"transition": "recycle",
"password": "lock",
"enable 2fa": "qrcode",
"disable 2fa": "qrcode"
"mfa": "qrcode"
}[event.category] }} bg-blue"></i>
<div class="timeline-item">
<span class="time"><i class="fas fa-clock"></i> {{ event.created_at.time().strftime("%H:%M") }}</span>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment