resetPassword in AuthController now returns nothing instead of token pair, just updates password. Button 'reset password' in reset password form now redirects to login page
This commit is contained in:
parent
88fcd9b63a
commit
3d9df20d45
@ -278,7 +278,7 @@ public class AuthController extends BaseController {
|
||||
@RequestMapping(value = "/noauth/resetPassword", method = RequestMethod.POST)
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@ResponseBody
|
||||
public JwtPair resetPassword(
|
||||
public void resetPassword(
|
||||
@ApiParam(value = "Reset password request.")
|
||||
@RequestBody ResetPasswordRequest resetPasswordRequest,
|
||||
HttpServletRequest request) throws ThingsboardException {
|
||||
@ -305,7 +305,6 @@ public class AuthController extends BaseController {
|
||||
|
||||
eventPublisher.publishEvent(new UserCredentialsInvalidationEvent(securityUser.getId()));
|
||||
|
||||
return tokenFactory.createTokenPair(securityUser);
|
||||
} else {
|
||||
throw new ThingsboardException("Invalid reset token!", ThingsboardErrorCode.BAD_REQUEST_PARAMS);
|
||||
}
|
||||
|
||||
@ -156,12 +156,10 @@ export class AuthService {
|
||||
));
|
||||
}
|
||||
|
||||
public resetPassword(resetToken: string, password: string): Observable<LoginResponse> {
|
||||
return this.http.post<LoginResponse>('/api/noauth/resetPassword', {resetToken, password}, defaultHttpOptions()).pipe(
|
||||
tap((loginResponse: LoginResponse) => {
|
||||
this.setUserFromJwtToken(loginResponse.token, loginResponse.refreshToken, true);
|
||||
}
|
||||
));
|
||||
public resetPassword(resetToken: string, password: string) {
|
||||
this.http.post('/api/noauth/resetPassword', {resetToken, password}, defaultHttpOptions()).subscribe(
|
||||
() => { this.router.navigateByUrl('login'); }, () => {}
|
||||
);
|
||||
}
|
||||
|
||||
public changePassword(currentPassword: string, newPassword: string, config?: RequestConfig) {
|
||||
|
||||
@ -71,7 +71,7 @@ export class ResetPasswordComponent extends PageComponent implements OnInit, OnD
|
||||
} else {
|
||||
this.authService.resetPassword(
|
||||
this.resetToken,
|
||||
this.resetPassword.get('newPassword').value).subscribe();
|
||||
this.resetPassword.get('newPassword').value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user