feat: user profile page - save info + change pwd

This commit is contained in:
NGPixel
2020-04-05 18:51:48 -04:00
committed by Nicolas Giard
parent c7f3c9d908
commit 1e4d513252
19 changed files with 1613 additions and 1062 deletions

View File

@@ -2,7 +2,7 @@
const Model = require('objection').Model
const moment = require('moment')
const nanoid = require('nanoid')
const nanoid = require('nanoid').nanoid
/**
* Users model

View File

@@ -341,6 +341,9 @@ module.exports = class User extends Model {
user.groups = await user.$relatedQuery('groups').select('groups.id', 'permissions')
}
// Update Last Login Date
await WIKI.models.users.query().findById(user.id).patch({ lastLoginAt: new Date().toISOString() })
return {
token: jwt.sign({
id: user.id,