mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-31 21:02:00 +08:00
feat: updated password is updated (#1102)
This commit is contained in:
parent
084d8ecccd
commit
0ef13a89ed
@ -1,7 +1,7 @@
|
|||||||
import { Button, notification, Space, Typography } from 'antd';
|
import { Button, notification, Space, Typography } from 'antd';
|
||||||
import changeMyPassword from 'api/user/changeMyPassword';
|
import changeMyPassword from 'api/user/changeMyPassword';
|
||||||
import { isPasswordNotValidMessage, isPasswordValid } from 'pages/SignUp/utils';
|
import { isPasswordNotValidMessage, isPasswordValid } from 'pages/SignUp/utils';
|
||||||
import React, { useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { AppState } from 'store/reducers';
|
import { AppState } from 'store/reducers';
|
||||||
@ -23,6 +23,14 @@ function PasswordContainer(): JSX.Element {
|
|||||||
ns: 'settings',
|
ns: 'settings',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (currentPassword && !isPasswordValid(currentPassword)) {
|
||||||
|
setIsPasswordPolicyError(true);
|
||||||
|
} else {
|
||||||
|
setIsPasswordPolicyError(false);
|
||||||
|
}
|
||||||
|
}, [currentPassword]);
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return <div />;
|
return <div />;
|
||||||
}
|
}
|
||||||
@ -104,11 +112,6 @@ function PasswordContainer(): JSX.Element {
|
|||||||
onChange={(event): void => {
|
onChange={(event): void => {
|
||||||
const updatedValue = event.target.value;
|
const updatedValue = event.target.value;
|
||||||
setUpdatePassword(updatedValue);
|
setUpdatePassword(updatedValue);
|
||||||
if (!isPasswordValid(updatedValue)) {
|
|
||||||
setIsPasswordPolicyError(true);
|
|
||||||
} else {
|
|
||||||
setIsPasswordPolicyError(false);
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
value={updatePassword}
|
value={updatePassword}
|
||||||
/>
|
/>
|
||||||
@ -130,7 +133,8 @@ function PasswordContainer(): JSX.Element {
|
|||||||
isLoading ||
|
isLoading ||
|
||||||
currentPassword.length === 0 ||
|
currentPassword.length === 0 ||
|
||||||
updatePassword.length === 0 ||
|
updatePassword.length === 0 ||
|
||||||
isPasswordPolicyError
|
isPasswordPolicyError ||
|
||||||
|
currentPassword !== updatePassword
|
||||||
}
|
}
|
||||||
loading={isLoading}
|
loading={isLoading}
|
||||||
onClick={onChangePasswordClickHandler}
|
onClick={onChangePasswordClickHandler}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user