Skip to content

Commit

Permalink
Merge pull request #9257 from weseek/fix/155634-155799-cannot-send-no…
Browse files Browse the repository at this point in the history
…t-exists-email-address

fix: forgot-password API
  • Loading branch information
yuki-takei authored Oct 18, 2024
2 parents 288df64 + 84714a8 commit 726105e
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 73 deletions.
13 changes: 0 additions & 13 deletions apps/app/resource/locales/en_US/notifications/notActiveUser.ejs

This file was deleted.

13 changes: 0 additions & 13 deletions apps/app/resource/locales/fr_FR/notifications/notActiveUser.ejs

This file was deleted.

13 changes: 0 additions & 13 deletions apps/app/resource/locales/ja_JP/notifications/notActiveUser.ejs

This file was deleted.

13 changes: 0 additions & 13 deletions apps/app/resource/locales/zh_CN/notifications/notActiveUser.ejs

This file was deleted.

19 changes: 11 additions & 8 deletions apps/app/src/pages/forgot-password.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { NextPage, GetServerSideProps, GetServerSidePropsContext } from 'ne
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import dynamic from 'next/dynamic';

import { RawLayout } from '~/components/Layout/RawLayout';
import type { CrowiRequest } from '~/interfaces/crowi-request';
import { useIsMailerSetup } from '~/stores-universal/context';

Expand All @@ -20,19 +21,21 @@ const ForgotPasswordPage: NextPage<Props> = (props: Props) => {
useIsMailerSetup(props.isMailerSetup);

return (
<div className="main">
<div className="container-lg">
<div className="container">
<div className="row justify-content-md-center">
<div className="col-md-6 mt-5">
<div className="text-center">
<PasswordResetRequestForm />
<RawLayout>
<div className="main">
<div className="container-lg">
<div className="container">
<div className="row justify-content-md-center">
<div className="col-md-6 mt-5">
<div className="text-center">
<PasswordResetRequestForm />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</RawLayout>
);
};

Expand Down
28 changes: 16 additions & 12 deletions apps/app/src/pages/reset-password.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { useTranslation } from 'next-i18next';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import dynamic from 'next/dynamic';

import { RawLayout } from '~/components/Layout/RawLayout';

import type { CommonProps } from './utils/commons';
import { getNextI18NextConfig, getServerSideCommonProps } from './utils/commons';

Expand All @@ -19,23 +21,25 @@ const ForgotPasswordPage: NextPage<Props> = (props: Props) => {
const { t } = useTranslation();

return (
<div className="main">
<div className="container-lg">
<div className="container">
<div className="row justify-content-md-center">
<div className="col-md-6 mt-5">
<div className="text-center">
<h1><span className="material-symbols-outlined large">lock_open</span></h1>
<h2 className="text-center">{ t('forgot_password.reset_password') }</h2>
<h5>{ props.email }</h5>
<p className="mt-4">{ t('forgot_password.password_reset_excecution_desc') }</p>
<PasswordResetExecutionForm />
<RawLayout>
<div className="main">
<div className="container-lg">
<div className="container">
<div className="row justify-content-md-center">
<div className="col-md-6 mt-5">
<div className="text-center">
<h1><span className="material-symbols-outlined large">lock_open</span></h1>
<h2 className="text-center">{ t('forgot_password.reset_password') }</h2>
<h5>{ props.email }</h5>
<p className="mt-4">{ t('forgot_password.password_reset_excecution_desc') }</p>
<PasswordResetExecutionForm />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</RawLayout>
);
};

Expand Down
3 changes: 2 additions & 1 deletion apps/app/src/server/routes/apiv3/forgot-password.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ module.exports = (crowi) => {

// when the user is not found or active
if (user == null || user.status !== 2) {
await sendPasswordResetEmail('notActiveUser', locale, email, appUrl);
// Do not send emails to non GROWI user
// For security reason, do not use error messages like "Email does not exist"
return res.apiv3();
}

Expand Down

0 comments on commit 726105e

Please sign in to comment.