added lastLogin to publishers

This commit is contained in:
Dobromir Popov
2024-04-25 19:51:13 +03:00
parent d28b82b1fa
commit 2fb9dc3803
6 changed files with 48 additions and 36 deletions

View File

@ -145,11 +145,17 @@ export const authOptions: NextAuthOptions = {
user.id = dbUser.id;
//user.permissions = dbUser.permissions;
const session = { ...user };
prisma.publisher.update({
where: { id: dbUser.id },
data: { lastLogin: new Date() }
});
return true; // Sign-in successful
} else {
// Optionally create a new user in your DB
// Or return false to deny access
return false;
//Let's customize the error message to give a better user experience
throw new Error(`Твоят имейл '${user.email}' не е регистриран в системата. Моля свържи се с нас за да те регистрираме ако искаш да ползваш този имейл.`);
}
} catch (e) {
console.log(e);