This commit is contained in:
the-djmaze 2024-03-17 15:10:59 +01:00
parent 9ccd616132
commit 58ad745373
2 changed files with 11 additions and 0 deletions

View file

@ -77,6 +77,16 @@ export class AdminSettingsSecurity extends AbstractViewSettings {
});
}
generateTOTP() {
let CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567',
length = 16,
secret = '';
while (0 < length--) {
secret += CHARS[Math.floor(Math.random() * 32)];
}
this.adminTOTP(secret);
}
saveAdminUserCommand() {
if (!this.adminLogin().trim()) {
this.adminLoginError(true);

View file

@ -65,6 +65,7 @@
<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off"
pattern="[A-Z2-7]{16,}"
data-bind="textInput: adminTOTP">
<button type="button" data-bind="click:generateTOTP">Generate</button>
</div>
<div class="control-group">
<label></label>