|
|
|
|
@ -9,7 +9,7 @@ const libphonenumberjs = require("libphonenumber-js");
|
|
|
|
|
const boom = require("boom");
|
|
|
|
|
|
|
|
|
|
// Get Data Models
|
|
|
|
|
const { User,Counter, generateBookingId } = require('../models/User')
|
|
|
|
|
const { User,Counter, generateBookingId,resetCounter } = require('../models/User')
|
|
|
|
|
//const User = require("../models/User");
|
|
|
|
|
|
|
|
|
|
const customJwtAuth = require("../customAuthJwt");
|
|
|
|
|
@ -160,7 +160,7 @@ exports.editCuurentUserInfo = async (req, reply) => {
|
|
|
|
|
// Function accepts username, password , encrypts password and saves it in the database.
|
|
|
|
|
exports.addUser = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
// await resetCounter();//to set customer id back to 0
|
|
|
|
|
var c_id = await generateBookingId()
|
|
|
|
|
var building= ((req.body.buildingName).slice(0, 3)).toUpperCase();
|
|
|
|
|
var customer_id = `AWS${building}${c_id}`
|
|
|
|
|
@ -263,7 +263,6 @@ exports.loginUser = async (req) => {
|
|
|
|
|
const password = req.body.password;
|
|
|
|
|
|
|
|
|
|
const user = await User.findOne({ phone: phone });
|
|
|
|
|
console.log(user.username)
|
|
|
|
|
// compare users password with what is supplied
|
|
|
|
|
if (user) {
|
|
|
|
|
isSame = await bcryptComparePassword(
|
|
|
|
|
|