添加两步验证

This commit is contained in:
hanhh
2021-08-30 23:37:26 +08:00
parent 0833aa3b30
commit d9c801a091
11 changed files with 592 additions and 154 deletions
+9 -2
View File
@@ -18,7 +18,12 @@ export default ({ app }: { app: Application }) => {
app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }));
app.use(
jwt({ secret: config.secret as string, algorithms: ['HS384'] }).unless({
path: ['/api/login', '/api/crons/status', /^\/open\//],
path: [
'/api/login',
'/api/crons/status',
/^\/open\//,
'/api/user/two-factor/login',
],
}),
);
@@ -52,7 +57,9 @@ export default ({ app }: { app: Application }) => {
if (
!headerToken &&
req.path &&
(req.path === '/api/login' || req.path === '/open/auth/token')
(req.path === '/api/login' ||
req.path === '/open/auth/token' ||
req.path === '/api/user/two-factor/login')
) {
return next();
}