prototyping the remainder of user reg workflow; some progress on login after register
This commit is contained in:
@@ -33,18 +33,7 @@ export default class AuthService {
|
||||
password: hash
|
||||
}
|
||||
|
||||
const res: IUser | null = await UserInstance.post(newData);
|
||||
if (res) receivedUser = res;
|
||||
|
||||
// basic profile setup
|
||||
res && await CollectionInstance.post({
|
||||
name: `${data.firstname}'s Collection`,
|
||||
active: true,
|
||||
ismaincollection: true,
|
||||
ownerid: res.id!.toString(),
|
||||
datecreated: now,
|
||||
datemodified: now
|
||||
});
|
||||
await UserInstance.post(newData);
|
||||
})
|
||||
|
||||
return true;
|
||||
|
||||
@@ -59,10 +59,8 @@ export const authRoute = (app: Express, passport: PassportStatic) => {
|
||||
try {
|
||||
const data: IUser = req.body;
|
||||
const response = await AuthInstance.register(data);
|
||||
if (!response) res.sendStatus(400);
|
||||
// const login = await AuthInstance.login({ email: data.email, password: data.password! });
|
||||
// console.log(login);
|
||||
res.status(200).redirect('/');
|
||||
if (!response) res.status(400).send({ ok: false });
|
||||
res.status(200).send({ ok: true });
|
||||
} catch(e) {
|
||||
next(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user