fix(striker-ui-api): add session cookie to hold expiry
This commit is contained in:
parent
b5927cf0a3
commit
34bd441c83
@ -7,13 +7,16 @@ export const login: RequestHandler<unknown, unknown, AuthLoginRequestBody> = (
|
|||||||
request,
|
request,
|
||||||
response,
|
response,
|
||||||
) => {
|
) => {
|
||||||
const { user } = request;
|
const { session, user } = request;
|
||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
const { name: userName } = user;
|
const { name: userName } = user;
|
||||||
|
|
||||||
stdout(`Successfully authenticated user [${userName}]`);
|
stdout(`Successfully authenticated user [${userName}]`);
|
||||||
|
|
||||||
|
response.cookie(cname('session'), {
|
||||||
|
expires: session?.cookie?.expires,
|
||||||
|
});
|
||||||
response.cookie(cname('user'), user);
|
response.cookie(cname('user'), user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,8 +11,9 @@ export const logout: RequestHandler = (request, response) => {
|
|||||||
return response.status(500).send();
|
return response.status(500).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
response.clearCookie(cname('user'));
|
response.clearCookie(cname('session'));
|
||||||
response.clearCookie(cname('sid'));
|
response.clearCookie(cname('sid'));
|
||||||
|
response.clearCookie(cname('user'));
|
||||||
|
|
||||||
return response.status(204).send();
|
return response.status(204).send();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user