Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new gmf-authentication-allow-password-reset option to gmf-authentication #3262

Merged
merged 1 commit into from
Dec 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion contribs/gmf/apps/desktop_alt/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
{{'Login' | translate}}
<a class="btn close" ng-click="mainCtrl.loginActive = false">&times;</a>
</div>
<gmf-authentication gmf-authentication-allow-password-change="false"></gmf-authentication>
<gmf-authentication gmf-authentication-allow-password-reset="false" gmf-authentication-allow-password-change="false"></gmf-authentication>
</div>
</div>
<div ng-show="mainCtrl.printPanelActive" class="row">
Expand Down
13 changes: 13 additions & 0 deletions contribs/gmf/src/directives/authenticationdirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ gmf.module.value('gmfAuthenticationTemplateUrl',
* Example:
*
* <gmf-authentication
* gmf-authentication-allow-password-reset="true"
* gmf-authentication-allow-password-change="true">
* </gmf-authentication>
*
* @param {string} gmfAuthenticationTemplateUrl Url to template.
* @htmlAttribute {boolean} gmf-authentication-allow-password-change Whether to
* show the change password button. Default to true.
* @htmlAttribute {boolean} gmf-authentication-allow-password-reset Whether to
* show the password forgotten link. Default to true.
* @return {angular.Directive} The Directive Definition Object.
* @ngInject
* @ngdoc directive
Expand All @@ -52,6 +55,7 @@ gmf.authenticationDirective = function(gmfAuthenticationTemplateUrl) {
return {
bindToController: true,
scope: {
'allowPasswordReset': '<?gmfAuthenticationAllowPasswordReset',
'allowPasswordChange': '<?gmfAuthenticationAllowPasswordChange'
},
controller: 'GmfAuthenticationController as authCtrl',
Expand Down Expand Up @@ -108,6 +112,12 @@ gmf.AuthenticationController = function(gettextCatalog, $scope,
*/
this.notification_ = ngeoNotification;

/**
* @type {boolean}
* @export
*/
this.allowPasswordReset;

/**
* @type {boolean}
* @export
Expand Down Expand Up @@ -179,6 +189,9 @@ gmf.AuthenticationController = function(gettextCatalog, $scope,
* Initialise the controller.
*/
gmf.AuthenticationController.prototype.$onInit = function() {
if (this.allowPasswordReset === undefined) {
this.allowPasswordReset = true;
}
if (this.allowPasswordChange === undefined) {
this.allowPasswordChange = true;
}
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/directives/partials/authentication.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ <h4 class="modal-title">
<span
ng-show="authCtrl.error"
class="gmf-authentication-error help-block"></span>
<div class="form-group">
<div ng-show="authCtrl.allowPasswordReset" class="form-group">
<a ng-click="authCtrl.resetPassword()"
href="">{{'Password forgotten?' | translate}}</a>
</div>
Expand Down