fix 2
This commit is contained in:
parent
f70da3ff9a
commit
bdfdefcef8
@ -48,11 +48,20 @@ export class AuthController {
|
||||
|
||||
let k: any = await this.authService.loginUser(body.P_EMAILADDR.toLowerCase(), body.P_PASSWORD, body.P_APPLICATIONNAME, req, 2);
|
||||
|
||||
let appDomain;
|
||||
if (req.headers.origin) {
|
||||
appDomain = extractSubdomain(req.headers.origin)
|
||||
}
|
||||
else {
|
||||
appDomain = ""
|
||||
}
|
||||
|
||||
if (k.access_token) {
|
||||
res.cookie('access_token', k.access_token, {
|
||||
httpOnly: true,
|
||||
secure: true,
|
||||
sameSite: 'none'
|
||||
sameSite: 'none',
|
||||
domain: `${appDomain.length > 0 ? appDomain + ".alphaomegainfosys.com" : "localhost"}`
|
||||
});
|
||||
}
|
||||
|
||||
@ -60,7 +69,8 @@ export class AuthController {
|
||||
res.cookie('refresh_token', k.refresh_token, {
|
||||
httpOnly: true,
|
||||
secure: true,
|
||||
sameSite: 'none'
|
||||
sameSite: 'none',
|
||||
domain: `${appDomain.length > 0 ? appDomain + ".alphaomegainfosys.com" : "localhost"}`
|
||||
});
|
||||
}
|
||||
|
||||
@ -117,16 +127,25 @@ export class AuthController {
|
||||
async logoutb(@Req() req: any, @Res() res: Response) {
|
||||
const refreshToken = req.user?.refreshToken;
|
||||
let rst: any = await this.authService.logoutUser(refreshToken);
|
||||
let appDomain;
|
||||
if (req.headers.origin) {
|
||||
appDomain = extractSubdomain(req.headers.origin)
|
||||
}
|
||||
else {
|
||||
appDomain = ""
|
||||
}
|
||||
if (rst.statusCode === 200) {
|
||||
res.clearCookie('access_token', {
|
||||
httpOnly: true,
|
||||
secure: true,
|
||||
sameSite: 'none'
|
||||
sameSite: 'none',
|
||||
domain: `${appDomain.length > 0 ? appDomain + ".alphaomegainfosys.com" : "localhost"}`
|
||||
});
|
||||
res.clearCookie('refresh_token', {
|
||||
httpOnly: true,
|
||||
secure: true,
|
||||
sameSite: 'none'
|
||||
sameSite: 'none',
|
||||
domain: `${appDomain.length > 0 ? appDomain + ".alphaomegainfosys.com" : "localhost"}`
|
||||
});
|
||||
}
|
||||
res.json({ ...rst })
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user