Skip to content

Commit

Permalink
Use loginAttempt service for change password
Browse files Browse the repository at this point in the history
  • Loading branch information
epixa committed Nov 20, 2018
1 parent 1ca91dd commit 612eeb3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions x-pack/plugins/security/server/routes/api/v1/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ export function initUsersApi(server) {

// Now we authenticate user with the new password again updating current session if any.
if (isCurrentUser) {
const authenticationResult = await server.plugins.security.authenticate(
BasicCredentials.decorateRequest(request, username, newPassword)
);
request.loginAttempt().setCredentials(username, newPassword);
const authenticationResult = await server.plugins.security.authenticate(request);

if (!authenticationResult.succeeded()) {
throw Boom.unauthorized((authenticationResult.error));
Expand Down

0 comments on commit 612eeb3

Please sign in to comment.