delete sessions when admin is deleted
This commit is contained in:
@@ -22,18 +22,22 @@ export const POST = (async ({ request, cookies }) => {
|
||||
username == env.ADMIN_USER &&
|
||||
password == env.ADMIN_PASSWORD
|
||||
) {
|
||||
cookies.set('session', addSession(new Permissions(Permissions.allPermissions())), {
|
||||
path: `${publicEnv.PUBLIC_BASE_PATH}/admin`,
|
||||
maxAge: 60 * 60 * 24 * 90,
|
||||
httpOnly: true,
|
||||
secure: true
|
||||
});
|
||||
cookies.set(
|
||||
'session',
|
||||
addSession({ id: -1, permissions: new Permissions(Permissions.allPermissions()) }),
|
||||
{
|
||||
path: `${publicEnv.PUBLIC_BASE_PATH}/admin`,
|
||||
maxAge: 60 * 60 * 24 * 90,
|
||||
httpOnly: true,
|
||||
secure: true
|
||||
}
|
||||
);
|
||||
return new Response();
|
||||
}
|
||||
|
||||
const user = await Admin.findOne({ where: { username: username } });
|
||||
if (user && user.validatePassword(password)) {
|
||||
cookies.set('session', addSession(user.permissions), {
|
||||
cookies.set('session', addSession(user), {
|
||||
path: `${publicEnv.PUBLIC_BASE_PATH}/admin`,
|
||||
maxAge: 60 * 60 * 24 * 90,
|
||||
httpOnly: true,
|
||||
|
||||
Reference in New Issue
Block a user