users controller improvements
This commit is contained in:
@@ -15,7 +15,9 @@ router.post(apiNamespace, (req, res) => {
|
||||
password,
|
||||
})
|
||||
.then(() => {
|
||||
res.json();
|
||||
res.json({
|
||||
success: true,
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
res.status(422).json({
|
||||
@@ -29,6 +31,13 @@ router.post(`${apiNamespace}/sign_in`, async (req, res) => {
|
||||
|
||||
const user = await UserService.findByEmail(email);
|
||||
|
||||
if (!user) {
|
||||
res.status(500).json({
|
||||
error: "Invalid credentails",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const isPasswordValid = await AuthService.isUserPasswordValid(user, password);
|
||||
|
||||
if (isPasswordValid) {
|
||||
|
||||
Reference in New Issue
Block a user