Fixed LastLogin not updating on register.

This commit is contained in:
lllllllillllllillll 2024-01-07 23:41:06 -08:00
parent 20c987f7ba
commit ec3ccc110e
3 changed files with 7 additions and 4 deletions

View file

@ -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){

View file

@ -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.

View file

@ -5,7 +5,7 @@
"main": "app.js",
"type": "module",
"scripts": {
"test": "mocha --require @babel/register --exit"
"test": "mocha --require @babel/register"
},
"keywords": [],
"author": "",