Commit 24ad2745 authored by Ibadullina Inabat's avatar Ibadullina Inabat

Merge branch 'task-156-feature/server_delivery' into 'development'

внесены изменения в бэк часть, убрали express-async-errors и добавлены условия в…

See merge request !125
parents bbc07128 ae181170
import 'express-async-errors'; // import 'express-async-errors';
import express, { NextFunction, Request, Response, Router } from "express"; // import expressAsyncErrors from 'express-async-errors';
import express, { NextFunction, Request, Response } from "express";
import { myDataSource } from "./app-data-source"; import { myDataSource } from "./app-data-source";
import { Task } from "./models/Task"; import { Task } from "./models/Task";
import { User } from "./models/User"; import { User } from "./models/User";
...@@ -188,7 +189,7 @@ export const memberFinderById = async (userId:string, projectId:string):Promise< ...@@ -188,7 +189,7 @@ export const memberFinderById = async (userId:string, projectId:string):Promise<
} }
export let transporter = nodemailer.createTransport({ export const transporter = nodemailer.createTransport({
service:'Yandex', service:'Yandex',
// host: "smtp.yandex.ru", // host: "smtp.yandex.ru",
// port: 465, // port: 465,
...@@ -207,6 +208,8 @@ export let transporter = nodemailer.createTransport({ ...@@ -207,6 +208,8 @@ export let transporter = nodemailer.createTransport({
} }
export const FRONTEND_URL = 'localhost:3000'; export let frontend_url = 'localhost:3000';
if (process.env.REACT_APP_NODE_ENV === "dev") {
frontend_url = "http://116.203.144.156:3000"
}
...@@ -4,7 +4,7 @@ import {myDataSource} from '../app-data-source'; ...@@ -4,7 +4,7 @@ import {myDataSource} from '../app-data-source';
import { nanoid } from 'nanoid'; import { nanoid } from 'nanoid';
import { PasswordRecovery } from '../models/PasswordRecovery'; import { PasswordRecovery } from '../models/PasswordRecovery';
import { transporter } from '../helpers'; import { transporter } from '../helpers';
import {FRONTEND_URL} from "../helpers"; import {frontend_url} from "../helpers";
import {SALT_WORK_FACTOR} from "../models/User"; import {SALT_WORK_FACTOR} from "../models/User";
import bcrypt from 'bcrypt'; import bcrypt from 'bcrypt';
const router:Router = express.Router(); const router:Router = express.Router();
...@@ -31,7 +31,7 @@ router.post ('/', async (req:Request, res:Response):Promise<void |Response>=>{ ...@@ -31,7 +31,7 @@ router.post ('/', async (req:Request, res:Response):Promise<void |Response>=>{
passwordRecovery.token=token; passwordRecovery.token=token;
await passwordRecovery.save() await passwordRecovery.save()
console.log('passwordRecover ' , passwordRecovery) console.log('passwordRecover ' , passwordRecovery)
const url = `${FRONTEND_URL}/reset-password/${token}`; const url = `${frontend_url}/reset-password/${token}`;
await transporter.sendMail({ await transporter.sendMail({
from:"planner45@yandex.com", from:"planner45@yandex.com",
to: `${email}`, to: `${email}`,
......
import 'express-async-errors'; // import 'express-async-errors';
import express,{Router, Request, Response } from 'express'; import express,{Router, Request, Response } from 'express';
import {Task} from '../models/Task'; import {Task} from '../models/Task';
import {myDataSource} from '../app-data-source'; import {myDataSource} from '../app-data-source';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment