mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-30 20:06:19 +00:00
fix(ui): forgot password success feedback (#11437)
This commit is contained in:
parent
7c60c85d71
commit
94ef30c3d5
@ -166,7 +166,6 @@ const BasicAuthProvider = ({
|
|||||||
|
|
||||||
const handleForgotPassword = async (email: string) => {
|
const handleForgotPassword = async (email: string) => {
|
||||||
try {
|
try {
|
||||||
setLoadingIndicator(true);
|
|
||||||
await generatePasswordResetLink(email);
|
await generatePasswordResetLink(email);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (
|
if (
|
||||||
@ -177,8 +176,6 @@ const BasicAuthProvider = ({
|
|||||||
} else {
|
} else {
|
||||||
showErrorToast(t('server.email-not-found'));
|
showErrorToast(t('server.email-not-found'));
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
setLoadingIndicator(false);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
import { Button, Card, Col, Divider, Form, Input, Row, Typography } from 'antd';
|
import { Button, Card, Col, Divider, Form, Input, Row, Typography } from 'antd';
|
||||||
import { useBasicAuth } from 'components/authentication/auth-provider/basic-auth.provider';
|
import { useBasicAuth } from 'components/authentication/auth-provider/basic-auth.provider';
|
||||||
import React, { useState } from 'react';
|
import React, { useCallback, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import { ROUTES } from '../../constants/constants';
|
import { ROUTES } from '../../constants/constants';
|
||||||
@ -24,17 +24,24 @@ const ForgotPassword = () => {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { handleForgotPassword } = useBasicAuth();
|
const { handleForgotPassword } = useBasicAuth();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
const [showResetLinkSentAlert, setShowResetLinkSentAlert] = useState(false);
|
const [showResetLinkSentAlert, setShowResetLinkSentAlert] = useState(false);
|
||||||
|
|
||||||
const handleSubmit = async (data: { email: string }) => {
|
const handleSubmit = useCallback(
|
||||||
try {
|
async (data: { email: string }) => {
|
||||||
handleForgotPassword && (await handleForgotPassword(data.email));
|
try {
|
||||||
setShowResetLinkSentAlert(true);
|
setLoading(true);
|
||||||
} catch (error) {
|
handleForgotPassword && (await handleForgotPassword(data.email));
|
||||||
setShowResetLinkSentAlert(false);
|
setShowResetLinkSentAlert(true);
|
||||||
}
|
} catch (error) {
|
||||||
};
|
setShowResetLinkSentAlert(false);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[setShowResetLinkSentAlert, handleForgotPassword]
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="h-full py-24 forgot-password-container ">
|
<div className="h-full py-24 forgot-password-container ">
|
||||||
@ -77,7 +84,7 @@ const ForgotPassword = () => {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col className="m-t-md" span={24}>
|
<Col className="m-t-md" span={24}>
|
||||||
<Button className="w-full" htmlType="submit" type="primary">
|
<Button block htmlType="submit" loading={loading} type="primary">
|
||||||
{t('label.submit')}
|
{t('label.submit')}
|
||||||
</Button>
|
</Button>
|
||||||
</Col>
|
</Col>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user