Fixed LastLogin not updating on register.
This commit is contained in:
parent
20c987f7ba
commit
ec3ccc110e
3 changed files with 7 additions and 4 deletions
|
@ -1,5 +1,4 @@
|
|||
import { User } from '../database/models.js';
|
||||
import { Syslog } from '../database/models.js';
|
||||
import { User, Syslog } from '../database/models.js';
|
||||
import bcrypt from 'bcrypt';
|
||||
|
||||
export const Login = function(req,res){
|
||||
|
|
|
@ -45,6 +45,9 @@ export const submitRegister = async function(req,res){
|
|||
if(!existingUser){
|
||||
|
||||
try {
|
||||
let currentDate = new Date();
|
||||
let newLogin = currentDate.toLocaleString();
|
||||
|
||||
const user = await User.create({
|
||||
name: name,
|
||||
username: username,
|
||||
|
@ -52,7 +55,8 @@ export const submitRegister = async function(req,res){
|
|||
password: bcrypt.hashSync(password,10),
|
||||
role: await userRole(),
|
||||
group: 'all',
|
||||
avatar: `<img src="img/avatars/${avatar}">`
|
||||
avatar: `<img src="img/avatars/${avatar}">`,
|
||||
lastLogin: newLogin,
|
||||
});
|
||||
|
||||
// make sure the user was created and get the UUID.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"main": "app.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "mocha --require @babel/register --exit"
|
||||
"test": "mocha --require @babel/register"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
|
Loading…
Add table
Reference in a new issue