mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix double change password calls (#50948)
This commit is contained in:
parent
5a35381f77
commit
32103fcd9f
@ -61,7 +61,19 @@ export class LoginCtrl extends PureComponent<Props, State> {
|
||||
oldPassword: 'admin',
|
||||
};
|
||||
|
||||
if (!this.props.resetCode) {
|
||||
if (this.props.resetCode) {
|
||||
const resetModel = {
|
||||
code: this.props.resetCode,
|
||||
newPassword: password,
|
||||
confirmPassword: password,
|
||||
};
|
||||
|
||||
getBackendSrv()
|
||||
.post('/api/user/password/reset', resetModel)
|
||||
.then(() => {
|
||||
this.toGrafana();
|
||||
});
|
||||
} else {
|
||||
getBackendSrv()
|
||||
.put('/api/user/password', pw)
|
||||
.then(() => {
|
||||
@ -69,18 +81,6 @@ export class LoginCtrl extends PureComponent<Props, State> {
|
||||
})
|
||||
.catch((err: any) => console.error(err));
|
||||
}
|
||||
|
||||
const resetModel = {
|
||||
code: this.props.resetCode,
|
||||
newPassword: password,
|
||||
confirmPassword: password,
|
||||
};
|
||||
|
||||
getBackendSrv()
|
||||
.post('/api/user/password/reset', resetModel)
|
||||
.then(() => {
|
||||
this.toGrafana();
|
||||
});
|
||||
};
|
||||
|
||||
login = (formModel: FormModel) => {
|
||||
|
Loading…
Reference in New Issue
Block a user