mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-10-01 01:25:45 -04:00
Fix 2fa for iOS Google authenticator (#486)
This commit is contained in:
parent
1ed4ac9494
commit
b246c8e0f2
@ -303,6 +303,12 @@ exports.entryPage = "dashboard";
|
|||||||
if (user.twofa_status == 0) {
|
if (user.twofa_status == 0) {
|
||||||
let newSecret = await genSecret();
|
let newSecret = await genSecret();
|
||||||
let encodedSecret = base32.encode(newSecret);
|
let encodedSecret = base32.encode(newSecret);
|
||||||
|
|
||||||
|
// Google authenticator doesn't like equal signs
|
||||||
|
// The fix is found at https://github.com/guyht/notp
|
||||||
|
// Related issue: https://github.com/louislam/uptime-kuma/issues/486
|
||||||
|
encodedSecret = encodedSecret.toString().replace(/=/g, "");
|
||||||
|
|
||||||
let uri = `otpauth://totp/Uptime%20Kuma:${user.username}?secret=${encodedSecret}`;
|
let uri = `otpauth://totp/Uptime%20Kuma:${user.username}?secret=${encodedSecret}`;
|
||||||
|
|
||||||
await R.exec("UPDATE `user` SET twofa_secret = ? WHERE id = ? ", [
|
await R.exec("UPDATE `user` SET twofa_secret = ? WHERE id = ? ", [
|
||||||
|
Loading…
Reference in New Issue
Block a user