Skip to content

Commit

Permalink
Change url and params for password change
Browse files Browse the repository at this point in the history
  • Loading branch information
fredj committed Oct 18, 2019
1 parent 37fd04a commit 541b733
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions contribs/gmf/src/authentication/Service.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import * as Sentry from '@sentry/browser';
* @hidden
*/
export const RouteSuffix = {
CHANGE_PASSWORD: 'loginchange',
CHANGE_PASSWORD: 'loginchangepassword',
IS_LOGGED_IN: 'loginuser',
LOGIN: 'login',
LOGOUT: 'logout',
Expand Down Expand Up @@ -149,15 +149,17 @@ export class AuthenticationService extends olEventsEventTarget {
}

/**
* @param {string} login Login.
* @param {string} oldPwd Old password.
* @param {string} newPwd New password.
* @param {string} confPwd New password confirmation.
* @return {angular.IPromise<void>} Promise.
*/
changePassword(oldPwd, newPwd, confPwd) {
changePassword(login, oldPwd, newPwd, confPwd) {
const url = `${this.baseUrl_}/${RouteSuffix.CHANGE_PASSWORD}`;

return this.$http_.post(url, $.param({
'login': login,
'oldPassword': oldPwd,
'newPassword': newPwd,
'confirmNewPassword': confPwd
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/authentication/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class AuthenticationController {
this.setError_(errors);
} else {
// Send request with current credentials, which may fail if the old password given is incorrect.
this.gmfAuthenticationService_.changePassword(oldPwd, newPwd, confPwd)
this.gmfAuthenticationService_.changePassword(this.gmfUser.username, oldPwd, newPwd, confPwd)
.then(() => {
this.changePasswordReset();
this.setError_(
Expand Down

0 comments on commit 541b733

Please sign in to comment.