Skip to content

Commit

Permalink
Display change password on login
Browse files Browse the repository at this point in the history
  • Loading branch information
ger-benjamin committed Feb 8, 2018
1 parent f59e9f3 commit 0885cf4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion contribs/gmf/examples/authentication.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
This example shows how to use the <code>gmf-authentication</code>
directive to insert an authentication panel in a GeoMapFish page.
</p>
<gmf-authentication></gmf-authentication>
<gmf-authentication gmf-authentication-force-password-change="true"></gmf-authentication>
<script src="../../../node_modules/jquery/dist/jquery.js"></script>
<script src="../../../third-party/jquery-ui/jquery-ui.min.js"></script>
<script src="../../../node_modules/angular/angular.js"></script>
Expand Down
12 changes: 7 additions & 5 deletions contribs/gmf/src/directives/authenticationdirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ gmf.AuthenticationController = function(gettextCatalog, $scope,
this.newPwdConfVal = '';

ol.events.listen(gmfAuthentication, gmf.AuthenticationEventType.READY,
this.onLoginReady_.bind(this));
this.onUserChange_.bind(this));
};


Expand Down Expand Up @@ -280,7 +280,10 @@ gmf.AuthenticationController.prototype.login = function() {
} else {
const error = gettextCatalog.getString('Incorrect username or password.');
this.gmfAuthentication_.login(this.loginVal, this.pwdVal).then(
this.resetError_.bind(this),
() => {
this.resetError_();
this.onUserChange_();
},
this.setError_.bind(this, error));
}
};
Expand Down Expand Up @@ -345,11 +348,10 @@ gmf.AuthenticationController.prototype.changePasswordReset = function() {


/**
* @param {gmf.AuthenticationEvent} e GMF Authentification event.
* @private
*/
gmf.AuthenticationController.prototype.onLoginReady_ = function(e) {
if (e.user.is_password_changed === false && this.forcePasswordChange) {
gmf.AuthenticationController.prototype.onUserChange_ = function() {
if (this.gmfUser.is_password_changed === false && this.forcePasswordChange) {
const gettextCatalog = this.gettextCatalog;
const msg = gettextCatalog.getString('You must change your password.');
this.notification_.notify({
Expand Down

0 comments on commit 0885cf4

Please sign in to comment.