Fix double change password calls (#50948)

This commit is contained in:
Jguer 2022-06-16 14:30:33 +00:00 committed by GitHub
parent 5a35381f77
commit 32103fcd9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,15 +61,7 @@ export class LoginCtrl extends PureComponent<Props, State> {
oldPassword: 'admin',
};
if (!this.props.resetCode) {
getBackendSrv()
.put('/api/user/password', pw)
.then(() => {
this.toGrafana();
})
.catch((err: any) => console.error(err));
}
if (this.props.resetCode) {
const resetModel = {
code: this.props.resetCode,
newPassword: password,
@ -81,6 +73,14 @@ export class LoginCtrl extends PureComponent<Props, State> {
.then(() => {
this.toGrafana();
});
} else {
getBackendSrv()
.put('/api/user/password', pw)
.then(() => {
this.toGrafana();
})
.catch((err: any) => console.error(err));
}
};
login = (formModel: FormModel) => {