👌 IMPROVE: Changements URL /profile en /users

This commit is contained in:
Divlo 2020-04-23 17:45:21 +02:00
parent 3ff7f40f7b
commit 316d2d1107
10 changed files with 31 additions and 31 deletions

View File

@ -148,7 +148,7 @@ exports.confirmEmail = async (req, res, next) => {
user.tempToken = null; user.tempToken = null;
user.isConfirmed = true; user.isConfirmed = true;
await user.save(); await user.save();
return res.redirect(`${FRONT_END_HOST}/login?isConfirmed=true`); return res.redirect(`${FRONT_END_HOST}/users/login?isConfirmed=true`);
} catch (error) { } catch (error) {
console.log(error); console.log(error);
return errorHandling(next, serverError); return errorHandling(next, serverError);
@ -174,7 +174,7 @@ exports.resetPassword = async (req, res, next) => {
from: `"FunctionProject" <${EMAIL_INFO.auth.user}>`, from: `"FunctionProject" <${EMAIL_INFO.auth.user}>`,
to: email, to: email,
subject: "FunctionProject - Réinitialisation du mot de passe", subject: "FunctionProject - Réinitialisation du mot de passe",
html: emailUserTemplate("Veuillez confirmer la réinitialisation du mot de passe", "Oui, je change mon mot de passe.", `${FRONT_END_HOST}/newPassword?token=${tempToken}`, "Si vous avez reçu ce message par erreur, il suffit de le supprimer. Votre mot de passe ne sera pas réinitialiser si vous ne cliquez pas sur le lien ci-dessus. Par ailleurs, pour la sécurité de votre compte, la réinitialisation du mot de passe est disponible pendant un délai de 1 heure, passez ce temps, la réinitialisation ne sera plus valide.") html: emailUserTemplate("Veuillez confirmer la réinitialisation du mot de passe", "Oui, je change mon mot de passe.", `${FRONT_END_HOST}/users/newPassword?token=${tempToken}`, "Si vous avez reçu ce message par erreur, il suffit de le supprimer. Votre mot de passe ne sera pas réinitialiser si vous ne cliquez pas sur le lien ci-dessus. Par ailleurs, pour la sécurité de votre compte, la réinitialisation du mot de passe est disponible pendant un délai de 1 heure, passez ce temps, la réinitialisation ne sera plus valide.")
}); });
return res.status(200).json({ result: "Demande de réinitialisation du mot de passe réussi, veuillez vérifier vos emails!" }); return res.status(200).json({ result: "Demande de réinitialisation du mot de passe réussi, veuillez vérifier vos emails!" });
} catch (error) { } catch (error) {

View File

@ -28,11 +28,11 @@ const CommentCard = forwardRef((props, ref) => {
<div ref={ref} className="CommentCard col-24"> <div ref={ref} className="CommentCard col-24">
<div className="CommentCard__container"> <div className="CommentCard__container">
<div className="row"> <div className="row">
<Link href={"/profile/[name]"} as={`/profile/${props.user.name}`}> <Link href={"/users/[name]"} as={`/users/${props.user.name}`}>
<img className="CommentCard__user-logo" src={API_URL + props.user.logo} alt={props.user.name} /> <img className="CommentCard__user-logo" src={API_URL + props.user.logo} alt={props.user.name} />
</Link> </Link>
<span className="CommentCard__message-info"> <span className="CommentCard__message-info">
<Link href={"/profile/[name]"} as={`/profile/${props.user.name}`}> <Link href={"/users/[name]"} as={`/users/${props.user.name}`}>
<a>{props.user.name}</a> <a>{props.user.name}</a>
</Link> </Link>
&nbsp;- {date.format(new Date(props.createdAt), 'DD/MM/YYYY à HH:mm', true)} &nbsp;- {date.format(new Date(props.createdAt), 'DD/MM/YYYY à HH:mm', true)}

View File

@ -40,14 +40,14 @@ export default function Header() {
{ {
(!isAuth) ? (!isAuth) ?
<Fragment> <Fragment>
<NavigationLink name="S'inscrire" path="/register" /> <NavigationLink name="S'inscrire" path="/users/register" />
<NavigationLink name="Connexion" path="/login" /> <NavigationLink name="Connexion" path="/users/login" />
</Fragment> </Fragment>
: :
<Fragment> <Fragment>
<li className="navbar-item"> <li className="navbar-item">
<Link href={"/profile/[name]"} as={`/profile/${user.name}`}> <Link href={"/users/[name]"} as={`/users/${user.name}`}>
<a className={`navbar-link ${pathname === "/profile/[name]" ? "navbar-link-active" : null}`}>Mon Profil</a> <a className={`navbar-link ${pathname === "/users/[name]" ? "navbar-link-active" : null}`}>Mon Profil</a>
</Link> </Link>
</li> </li>
<li className="navbar-item"> <li className="navbar-item">

View File

@ -85,7 +85,7 @@ const manageQuotes = (props) => {
<td className="table-row text-center">{currentQuote.quote}</td> <td className="table-row text-center">{currentQuote.quote}</td>
<td className="table-row text-center">{currentQuote.author}</td> <td className="table-row text-center">{currentQuote.author}</td>
<td className="table-row text-center"> <td className="table-row text-center">
<Link href={"/profile/[name]"} as={`/profile/${currentQuote.user.name}`}> <Link href={"/users/[name]"} as={`/users/${currentQuote.user.name}`}>
<a>{currentQuote.user.name}</a> <a>{currentQuote.user.name}</a>
</Link> </Link>
</td> </td>

View File

@ -130,7 +130,7 @@ const QuoteList = () => {
<td className="table-row text-center">{currentQuote.quote}</td> <td className="table-row text-center">{currentQuote.quote}</td>
<td className="table-row text-center">{currentQuote.author}</td> <td className="table-row text-center">{currentQuote.author}</td>
<td className="table-row text-center"> <td className="table-row text-center">
<Link href={"/profile/[name]"} as={`/profile/${currentQuote.user.name}`}> <Link href={"/users/[name]"} as={`/users/${currentQuote.user.name}`}>
<a>{currentQuote.user.name}</a> <a>{currentQuote.user.name}</a>
</Link> </Link>
</td> </td>

View File

@ -1,10 +1,10 @@
import { Fragment, useState } from 'react'; import { Fragment, useState } from 'react';
import htmlParser from 'html-react-parser'; import htmlParser from 'html-react-parser';
import Loader from '../components/Loader'; import Loader from '../../components/Loader';
import HeadTag from '../components/HeadTag'; import HeadTag from '../../components/HeadTag';
import api from '../utils/api'; import api from '../../utils/api';
import withoutAuth from '../hoc/withoutAuth'; import withoutAuth from '../../hoc/withoutAuth';
import '../public/css/pages/register-login.css'; import '../../public/css/pages/register-login.css';
const forgotPassword = () => { const forgotPassword = () => {

View File

@ -2,11 +2,11 @@ import { Fragment, useContext, useState } from 'react';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import Link from 'next/link'; import Link from 'next/link';
import htmlParser from 'html-react-parser'; import htmlParser from 'html-react-parser';
import Loader from '../components/Loader'; import Loader from '../../components/Loader';
import HeadTag from '../components/HeadTag'; import HeadTag from '../../components/HeadTag';
import { UserContext } from '../contexts/UserContext'; import { UserContext } from '../../contexts/UserContext';
import withoutAuth from '../hoc/withoutAuth'; import withoutAuth from '../../hoc/withoutAuth';
import '../public/css/pages/register-login.css'; import '../../public/css/pages/register-login.css';
const Login = () => { const Login = () => {

View File

@ -1,11 +1,11 @@
import { Fragment, useState } from 'react'; import { Fragment, useState } from 'react';
import htmlParser from 'html-react-parser'; import htmlParser from 'html-react-parser';
import Loader from '../components/Loader'; import Loader from '../../components/Loader';
import HeadTag from '../components/HeadTag'; import HeadTag from '../../components/HeadTag';
import api from '../utils/api'; import api from '../../utils/api';
import redirect from '../utils/redirect'; import redirect from '../../utils/redirect';
import withoutAuth from '../hoc/withoutAuth'; import withoutAuth from '../../hoc/withoutAuth';
import '../public/css/pages/register-login.css'; import '../../public/css/pages/register-login.css';
const newPassword = (props) => { const newPassword = (props) => {

View File

@ -1,10 +1,10 @@
import { Fragment, useState } from 'react'; import { Fragment, useState } from 'react';
import htmlParser from 'html-react-parser'; import htmlParser from 'html-react-parser';
import Loader from '../components/Loader'; import Loader from '../../components/Loader';
import HeadTag from '../components/HeadTag'; import HeadTag from '../../components/HeadTag';
import api from '../utils/api'; import api from '../../utils/api';
import withoutAuth from '../hoc/withoutAuth'; import withoutAuth from '../../hoc/withoutAuth';
import '../public/css/pages/register-login.css'; import '../../public/css/pages/register-login.css';
const Register = () => { const Register = () => {