mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 05:09:43 +02:00
feat: Invalidate access token on logout
This commit is contained in:
parent
f091de6827
commit
48ea62c0a0
26 changed files with 242 additions and 37 deletions
|
@ -1,6 +1,8 @@
|
|||
const bcrypt = require('bcrypt');
|
||||
const zxcvbn = require('zxcvbn');
|
||||
|
||||
const { getRemoteAddress } = require('../../../utils/remoteAddress');
|
||||
|
||||
const Errors = {
|
||||
USER_NOT_FOUND: {
|
||||
userNotFound: 'User not found',
|
||||
|
@ -71,6 +73,13 @@ module.exports = {
|
|||
if (user.id === currentUser.id) {
|
||||
const accessToken = sails.helpers.utils.createToken(user.id, user.passwordUpdatedAt);
|
||||
|
||||
await Session.create({
|
||||
accessToken,
|
||||
userId: user.id,
|
||||
remoteAddress: getRemoteAddress(this.req),
|
||||
userAgent: this.req.headers['user-agent'],
|
||||
});
|
||||
|
||||
return {
|
||||
item: user,
|
||||
included: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue