|
|
@ -45,6 +45,12 @@ module.exports.registerUser = (request, response) => {
|
|
|
|
module.exports.loginUser = (request, response) => {
|
|
|
|
module.exports.loginUser = (request, response) => {
|
|
|
|
const reqBody = request.body;
|
|
|
|
const reqBody = request.body;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let filename = __filename;
|
|
|
|
|
|
|
|
let dirname = __dirname;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(filename)
|
|
|
|
|
|
|
|
console.log(dirname)
|
|
|
|
|
|
|
|
|
|
|
|
User.findOne({email : reqBody.email}).then(result => {
|
|
|
|
User.findOne({email : reqBody.email}).then(result => {
|
|
|
|
if(result === null) {
|
|
|
|
if(result === null) {
|
|
|
|
return response.send(false);
|
|
|
|
return response.send(false);
|
|
|
@ -56,7 +62,7 @@ module.exports.loginUser = (request, response) => {
|
|
|
|
|
|
|
|
|
|
|
|
const token = auth.createAccessToken(result);
|
|
|
|
const token = auth.createAccessToken(result);
|
|
|
|
|
|
|
|
|
|
|
|
return response.send({accessToken: token});
|
|
|
|
return response.send({accessToken: token, filename: filename, dirname: dirname});
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
return response.send(false);
|
|
|
|
return response.send(false);
|
|
|
|