ryoji-s 3 лет назад
Родитель
Сommit
c9e3d2c148

+ 0 - 2
packages/app/src/components/Admin/Security/LocalSecuritySettingContents.jsx

@@ -172,7 +172,6 @@ class LocalSecuritySettingContents extends React.Component {
                     id="isPasswordResetEnabled"
                     checked={isPasswordResetEnabled}
                     onChange={() => adminLocalSecurityContainer.switchIsPasswordResetEnabled()}
-                    disabled={!isMailerSetup}
                   />
                   <label className="custom-control-label" htmlFor="isPasswordResetEnabled">
                     {t('security_settings.Local.enable_password_reset_by_users')}
@@ -202,7 +201,6 @@ class LocalSecuritySettingContents extends React.Component {
                     id="isEmailAuthenticationEnabled"
                     checked={isEmailAuthenticationEnabled}
                     onChange={() => adminLocalSecurityContainer.switchIsEmailAuthenticationEnabled()}
-                    disabled={!isMailerSetup}
                   />
                   <label className="custom-control-label" htmlFor="isEmailAuthenticationEnabled">
                     {t('security_settings.Local.enable_email_authentication')}

+ 17 - 3
packages/app/src/components/PasswordResetRequestForm.tsx

@@ -5,10 +5,11 @@ import Link from 'next/link';
 
 import { apiv3Post } from '~/client/util/apiv3-client';
 import { toastSuccess, toastError } from '~/client/util/toastr';
-
+import { useIsMailerSetup } from '~/stores/context';
 
 const PasswordResetRequestForm: FC = () => {
   const { t } = useTranslation();
+  const { data: isMailerSetup } = useIsMailerSetup();
   const [email, setEmail] = useState('');
 
   const changeEmail = useCallback((inputValue) => {
@@ -33,16 +34,29 @@ const PasswordResetRequestForm: FC = () => {
 
   return (
     <form onSubmit={sendPasswordResetRequestMail}>
-      <h3>{ t('forgot_password.password_reset_request_desc') }</h3>
+      {!isMailerSetup && (
+        <div className="alert alert-danger">
+          {t('commons:alert.password_reset_please_enable_mailer')}
+        </div>
+      )}
+      <h3>{t('forgot_password.password_reset_request_desc')}</h3>
       <div className="form-group">
         <div className="input-group">
-          <input name="email" placeholder="E-mail Address" className="form-control" type="email" onChange={e => changeEmail(e.target.value)} />
+          <input
+            name="email"
+            placeholder="E-mail Address"
+            className="form-control"
+            type="email"
+            disabled={!isMailerSetup}
+            onChange={e => changeEmail(e.target.value)}
+          />
         </div>
       </div>
       <div className="form-group">
         <button
           className="btn btn-lg btn-primary btn-block"
           type="submit"
+          disabled={!isMailerSetup}
         >
           {t('forgot_password.send')}
         </button>

+ 1 - 1
packages/app/src/server/service/config-loader.ts

@@ -368,7 +368,7 @@ const ENV_VAR_NAME_TO_CONFIG_INFO = {
     ns:      'crowi',
     key:     'security:passport-local:isPasswordResetEnabled',
     type:    ValueType.BOOLEAN,
-    default: false,
+    default: true,
   },
   LOCAL_STRATEGY_EMAIL_AUTHENTICATION_ENABLED: {
     ns:      'crowi',