- Linty fresh...
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2023-05-02 02:04:09 -04:00
parent 14fe45fc9c
commit 34acea15a2
17 changed files with 1203 additions and 559 deletions

View File

@@ -1,20 +1,19 @@
import passport from 'koa-passport';
import { Strategy } from 'passport-local';
import bcrypt from 'bcrypt';
import Auth from '../model/auth';
import { AuthSchema } from '../schema/auth';
export const LocalStrategy = passport.use(new Strategy(async (username, password, done) => {
export const localStrategy = passport.use(
new Strategy(async (username, password, done) => {
const user = await Auth.findOne({
where: {
username,
}
where: {
username,
}
}).catch();
if (user && user.authenticate(password)) {
done(null, user);
done(null, user);
} else {
done(null, false);
done(null, false);
}
}
));
})
);