mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-01 04:40:38 +08:00
修复token唯一性验证
This commit is contained in:
+3
-3
@@ -4,7 +4,7 @@ import { Logger } from 'winston';
|
||||
import * as fs from 'fs';
|
||||
import config from '../config';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { createPassword } from '../config/util';
|
||||
import { createRandomString } from '../config/util';
|
||||
import crypto from 'crypto';
|
||||
const route = Router();
|
||||
|
||||
@@ -25,7 +25,7 @@ export default (app: Router) => {
|
||||
authInfo.username === 'admin' &&
|
||||
authInfo.password === 'adminadmin'
|
||||
) {
|
||||
const newPassword = createPassword(16, 22);
|
||||
const newPassword = createRandomString(16, 22);
|
||||
fs.writeFileSync(
|
||||
config.authConfigFile,
|
||||
JSON.stringify({
|
||||
@@ -42,7 +42,7 @@ export default (app: Router) => {
|
||||
username == authInfo.username &&
|
||||
password == authInfo.password
|
||||
) {
|
||||
const data = createPassword(50, 100);
|
||||
const data = createRandomString(50, 100);
|
||||
let token = jwt.sign({ data }, config.secret as any, {
|
||||
expiresIn: 60 * 60 * 24 * 3,
|
||||
algorithm: 'HS384',
|
||||
|
||||
Reference in New Issue
Block a user