|
|
@@ -3,14 +3,14 @@ import React, { useState, useEffect, useCallback } from 'react';
|
|
|
import { useTranslation } from 'next-i18next';
|
|
|
|
|
|
import { apiv3Get, apiv3Post } from '~/client/util/apiv3-client';
|
|
|
+import { userActivationErrorCode } from '~/interfaces/errors/user-activation';
|
|
|
|
|
|
import { toastSuccess, toastError } from '../client/util/apiNotification';
|
|
|
|
|
|
interface Props {
|
|
|
- messageErrors?: any,
|
|
|
- inputs?: any,
|
|
|
email: string,
|
|
|
token: string,
|
|
|
+ errorCode?: userActivationErrorCode,
|
|
|
isEmailAuthenticationEnabled: boolean,
|
|
|
}
|
|
|
|
|
|
@@ -18,9 +18,10 @@ const CompleteUserRegistrationForm: React.FC<Props> = (props: Props) => {
|
|
|
|
|
|
const { t } = useTranslation();
|
|
|
const {
|
|
|
- messageErrors,
|
|
|
email,
|
|
|
token,
|
|
|
+ errorCode,
|
|
|
+ isEmailAuthenticationEnabled,
|
|
|
} = props;
|
|
|
|
|
|
const [usernameAvailable, setUsernameAvailable] = useState(true);
|
|
|
@@ -63,19 +64,23 @@ const CompleteUserRegistrationForm: React.FC<Props> = (props: Props) => {
|
|
|
|
|
|
return (
|
|
|
<>
|
|
|
- <div id="register-form-errors">
|
|
|
- {messageErrors && (
|
|
|
- <div className="alert alert-danger">
|
|
|
- { messageErrors }
|
|
|
- </div>
|
|
|
- )}
|
|
|
- </div>
|
|
|
-
|
|
|
<div className="noLogin-dialog mx-auto" id="noLogin-dialog">
|
|
|
<div className="row mx-0">
|
|
|
<div className="col-12">
|
|
|
|
|
|
- { !props.isEmailAuthenticationEnabled && (
|
|
|
+ { (errorCode != null && errorCode === userActivationErrorCode.TOKEN_NOT_FOUND) && (
|
|
|
+ <p className="alert alert-danger">
|
|
|
+ <span>Token not found</span>
|
|
|
+ </p>
|
|
|
+ )}
|
|
|
+
|
|
|
+ { (errorCode != null && errorCode === userActivationErrorCode.USER_REGISTRATION_ORDER_IS_NOT_APPROPRIATE) && (
|
|
|
+ <p className="alert alert-danger">
|
|
|
+ <span>{t('message.incorrect_token_or_expired_url')}</span>
|
|
|
+ </p>
|
|
|
+ )}
|
|
|
+
|
|
|
+ { !isEmailAuthenticationEnabled && (
|
|
|
<p className="alert alert-danger">
|
|
|
<span>{t('message.email_authentication_is_not_enabled')}</span>
|
|
|
</p>
|