dbeaver/pro#9901 reset password after submit (#4542)

Co-authored-by: Daria Marutkina <125263541+dariamarutkina@users.noreply.github.com>
This commit is contained in:
alex
2026-08-11 15:22:11 +02:00
committed by GitHub
co-authored by Daria Marutkina
parent 7a93d56459
commit 5fb7234e24
@@ -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>