preparing to checkout
This commit is contained in:
@@ -22,7 +22,7 @@ export default class AuthService {
|
||||
if (user) throw createError('409', 'Email already in use');
|
||||
|
||||
// hash password and create new user record
|
||||
return bcrypt.genSalt(10, (err, salt) => {
|
||||
bcrypt.genSalt(10, (err, salt) => {
|
||||
if (err) throw err;
|
||||
bcrypt.hash(password!, salt, async (err, hash) => {
|
||||
if (err) throw err;
|
||||
@@ -46,6 +46,8 @@ export default class AuthService {
|
||||
return result;
|
||||
})
|
||||
})
|
||||
|
||||
return true;
|
||||
} catch (e: any) {
|
||||
throw new Error(e);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import { appRoot } from "../appRoot";
|
||||
dotenv.config();
|
||||
|
||||
(async function() {
|
||||
console.clear();
|
||||
|
||||
const setRole = `
|
||||
SET ROLE postgres;
|
||||
DROP SCHEMA IF EXISTS recipin CASCADE;
|
||||
|
||||
@@ -15,8 +15,10 @@ export const authRoute = (app: Express, passport: PassportStatic) => {
|
||||
app.use('/auth', router);
|
||||
|
||||
router.get('/', restrictAccess, (req, res, next) => {
|
||||
if (!req.user) return;
|
||||
|
||||
// @ts-ignore: does not recognize structure of req.user
|
||||
const user = req.user?.user;
|
||||
const { user } = req.user;
|
||||
const userData = {
|
||||
id: user.id,
|
||||
firstname: user.firstname,
|
||||
|
||||
Reference in New Issue
Block a user