mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: remove stupid base32 encoder
This commit is contained in:
1 parent
6ac3ea11f2
commit
954d084b4f
2 files changed
+2
-5
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.40.4",
|
"version": "4.40.5",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
@@ -102,7 +102,6 @@
|
|||||||
"stylus-loader": "^7.0.0",
|
"stylus-loader": "^7.0.0",
|
||||||
"tether": "1.4.7",
|
"tether": "1.4.7",
|
||||||
"tether-drop": "^1.4.2",
|
"tether-drop": "^1.4.2",
|
||||||
"thirty-two": "^1.0.2",
|
|
||||||
"through2": "^4.0.2",
|
"through2": "^4.0.2",
|
||||||
"timeago-react": "^3.0.5",
|
"timeago-react": "^3.0.5",
|
||||||
"timeago.js": "^4.0.2",
|
"timeago.js": "^4.0.2",
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import QRCode from 'qrcode';
|
import QRCode from 'qrcode';
|
||||||
import b32 from 'thirty-two';
|
|
||||||
import { ActionDialog } from 'vj/components/dialog';
|
import { ActionDialog } from 'vj/components/dialog';
|
||||||
import Notification from 'vj/components/notification';
|
import Notification from 'vj/components/notification';
|
||||||
import { NamedPage } from 'vj/misc/Page';
|
import { NamedPage } from 'vj/misc/Page';
|
||||||
@@ -34,8 +33,7 @@ export default new NamedPage('home_security', () => {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
}).open();
|
}).open();
|
||||||
const secret = b32.encode(crypto.getRandomValues(new Uint8Array(8)))
|
const secret = String.random(13, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567');
|
||||||
.toString('utf8').replace(/=/g, '').toUpperCase();
|
|
||||||
$('#secret').on('click', () => $('#secret').html(secret));
|
$('#secret').on('click', () => $('#secret').html(secret));
|
||||||
const uri = `otpauth://totp/Hydro:${UserContext.uname}?secret=${secret}&issuer=Hydro`;
|
const uri = `otpauth://totp/Hydro:${UserContext.uname}?secret=${secret}&issuer=Hydro`;
|
||||||
const canvas = document.getElementById('qrcode');
|
const canvas = document.getElementById('qrcode');
|
||||||
|
|||||||
Reference in new issue
Block a user