|
|
@ -9,8 +9,7 @@ const libphonenumberjs = require("libphonenumber-js");
|
|
|
|
const boom = require("boom");
|
|
|
|
const boom = require("boom");
|
|
|
|
|
|
|
|
|
|
|
|
// Get Data Models
|
|
|
|
// Get Data Models
|
|
|
|
//const User = require("../models/User");
|
|
|
|
const User = require("../models/User");
|
|
|
|
const { User, Counter,Test } = require('../models/User');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const customJwtAuth = require("../customAuthJwt");
|
|
|
|
const customJwtAuth = require("../customAuthJwt");
|
|
|
|
const fastify = require("fastify")({
|
|
|
|
const fastify = require("fastify")({
|
|
|
@ -251,8 +250,9 @@ exports.loginUser = async (req) => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const phone = req.body.phone;
|
|
|
|
const phone = req.body.phone;
|
|
|
|
const password = req.body.password;
|
|
|
|
const password = req.body.password;
|
|
|
|
|
|
|
|
|
|
|
|
const user = await User.findOne({ phone: phone });
|
|
|
|
const user = await User.findOne({ phone: phone });
|
|
|
|
|
|
|
|
console.log(user.username)
|
|
|
|
// compare users password with what is supplied
|
|
|
|
// compare users password with what is supplied
|
|
|
|
if (user) {
|
|
|
|
if (user) {
|
|
|
|
isSame = await bcryptComparePassword(
|
|
|
|
isSame = await bcryptComparePassword(
|
|
|
|