mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-19 10:56:04 +08:00
dbeaver/pro#9901 reset password after submit (#4542)
Co-authored-by: Daria Marutkina <125263541+dariamarutkina@users.noreply.github.com>
This commit is contained in:
+17
-2
@@ -5,13 +5,16 @@
|
||||
* Licensed under the Apache License, Version 2.0.
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { useState } from 'react';
|
||||
|
||||
import { AUTH_PROVIDER_LOCAL_ID, AuthProvidersResource, isLocalUser, UsersResource } from '@cloudbeaver/core-authentication';
|
||||
import {
|
||||
Container,
|
||||
GroupTitle,
|
||||
InputField,
|
||||
useExecutor,
|
||||
useFormCustomInputValidation,
|
||||
usePasswordValidation,
|
||||
useResource,
|
||||
@@ -39,6 +42,8 @@ export const UserFormInfoCredentials = observer<Props>(function UserFormInfoCred
|
||||
const authProvidersResource = useResource(UserFormInfoCredentials, AuthProvidersResource, null);
|
||||
const passwordValidationRef = usePasswordValidation();
|
||||
|
||||
const [repeatedPassword, setRepeatedPassword] = useState('');
|
||||
|
||||
let local = authProvidersResource.resource.isEnabled(AUTH_PROVIDER_LOCAL_ID);
|
||||
|
||||
if (!local) {
|
||||
@@ -66,6 +71,15 @@ export const UserFormInfoCredentials = observer<Props>(function UserFormInfoCred
|
||||
return null;
|
||||
});
|
||||
|
||||
useExecutor({
|
||||
executor: formState.submitTask,
|
||||
handlers: [
|
||||
function handleSubmit(data) {
|
||||
setRepeatedPassword('');
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
return (
|
||||
<Container gap vertical>
|
||||
<GroupTitle keepSize>{translate('authentication_user_credentials')}</GroupTitle>
|
||||
@@ -102,13 +116,14 @@ export const UserFormInfoCredentials = observer<Props>(function UserFormInfoCred
|
||||
<InputField
|
||||
ref={passwordRepeatRef}
|
||||
type="password"
|
||||
name="passwordRepeat"
|
||||
placeholder={editing ? PASSWORD_PLACEHOLDER : ''}
|
||||
readOnly={disabled}
|
||||
required={!editing}
|
||||
canShowPassword
|
||||
value={repeatedPassword}
|
||||
canShowPassword={repeatedPassword !== ''}
|
||||
keepSize
|
||||
tiny
|
||||
onChange={v => setRepeatedPassword(v)}
|
||||
>
|
||||
{translate('authentication_user_password_repeat')}
|
||||
</InputField>
|
||||
|
||||
Reference in New Issue
Block a user