Skip to content

Commit

Permalink
✔ Fix Session Login Checks
Browse files Browse the repository at this point in the history
  • Loading branch information
bifeldy committed Jul 2, 2023
1 parent dc298fc commit 5f18ba7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/fansubid/browser/ngsw.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"configVersion": 1,
"timestamp": 1688177530327,
"timestamp": 1688280024304,
"index": "/index.html",
"assetGroups": [
{
Expand Down
2 changes: 1 addition & 1 deletion dist/fansubid/server/main.js

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions src/api/middlewares/banned.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ export class BannedMiddleware implements NestMiddleware {
if (user) {
const clientOriginIpCc = this.aks.getOriginIpCc(req, true);
if (user.session_origin !== clientOriginIpCc.origin_ip) {
throw new HttpException({
info: '🙄 401 - Sesion :: Expired 😪',
result: {
message: 'Silahkan Login Ulang!'
}
}, HttpStatus.UNAUTHORIZED);
res.cookie(environment.tokenName, 'TOKEN_EXPIRED', {
httpOnly: true,
secure: environment.production,
sameSite: 'strict',
maxAge: 0,
domain: environment.domain
});
return res.redirect(301, environment.baseUrl);
}
}
}
Expand Down

0 comments on commit 5f18ba7

Please sign in to comment.