- Connecting the dots?
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2023-05-02 21:47:45 -04:00
parent 5fba4c6643
commit 68f58329e8
10 changed files with 81 additions and 39 deletions

View File

@@ -0,0 +1,18 @@
import passport from 'koa-passport';
// eslint-disable-next-line import/named
import { Strategy as LocalStrategy } from 'passport-local';
import Auth from '../../model/auth';
export default new LocalStrategy(async (username: string, password: string, done: any) => {
const user = await Auth.findOne({
where: {
username,
},
}).catch();
if (user && user.authenticate(password)) {
done(null, user);
} else {
done(null, false);
}
});