Browse Source

added destroyOTPSession, so that one can remove OTP account

develop
Andrew Woodlee 2 years ago
parent
commit
4ac56f1315
  1. 5
      app/services/otp-auth.js
  2. 8
      app/views/admin/otp/index.pug
  3. 3
      app/views/otp/new-account.pug

5
app/services/otp-auth.js

@ -217,6 +217,11 @@ class OtpAuthService extends SiteService {
return true;
}
async destroyOtpSession (req, serviceName) {
delete req.session.otp[serviceName];
await this.saveSession(req)
}
async removeForUser (user) {
return await OtpAccount.deleteMany({ user: user });
}

8
app/views/admin/otp/index.pug

@ -5,10 +5,14 @@ block content
div(uk-grid).uk-flex-middle
.uk-width-expand
h1.margin-remove Tokens
.uk-width-auto
section.uk-section.uk-section-default.uk-section-xsmall
.uk-container
.uk-text-small
h4 This is where you will regenerate OTP tokens for your admin account and destroy your old OTP account.
//- .uk-width-auto
button(
type="button",
data-user= user,
data-user= user._id,
onclick="return dtp.adminApp.generateOTPTokens(event);",
).uk-button.dtp-button-danger
+renderButtonIcon('fa-repeat', 'Generate OTP Tokens')

3
app/views/otp/new-account.pug

@ -17,5 +17,6 @@ block content
section.uk-section.uk-section-default.uk-section-xsmall
.uk-container
p Your account is now enabled with access to #{site.name} #{otpServiceName}.
p Your account is now enabled with access to #{site.name} #{otpAccount.service}.
a(href= otpRedirectURL, title="Continue").uk-button.uk-button-primary.uk-border-pill Continue

Loading…
Cancel
Save