mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 06:46:09 +08:00
修复token验证
This commit is contained in:
parent
0c3b3c206e
commit
ebcf8f96c8
|
@ -19,9 +19,6 @@ export default ({ app }: { app: Application }) => {
|
|||
}),
|
||||
);
|
||||
app.use((req, res, next) => {
|
||||
if (req.url && req.path.includes('/api/login')) {
|
||||
return next();
|
||||
}
|
||||
const data = fs.readFileSync(config.authConfigFile, 'utf8');
|
||||
const headerToken = getToken(req);
|
||||
if (data) {
|
||||
|
@ -30,6 +27,9 @@ export default ({ app }: { app: Application }) => {
|
|||
return next();
|
||||
}
|
||||
}
|
||||
if (!headerToken && req.url && req.path === '/api/login') {
|
||||
return next();
|
||||
}
|
||||
const err: any = new Error('UnauthorizedError');
|
||||
err['status'] = 401;
|
||||
next(err);
|
||||
|
|
Loading…
Reference in New Issue
Block a user