-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
9097 add contextual password helper (#9256)
* update back-office forms * Display tip on reset password page as well * add directive for password tip * integrate directove in login screen * forgot the ng-keyup :-) * adapt tooltip directive to potential different Members and Users password settings * remove watcher Co-authored-by: Nathan Woulfe <[email protected]>
- Loading branch information
1 parent
3d05bd6
commit 88611f3
Showing
10 changed files
with
104 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...co.Web.UI.Client/src/common/directives/components/application/umbpasswordtip.directive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
angular | ||
.module('umbraco.directives') | ||
.component('umbPasswordTip', { | ||
controller: UmbPasswordTipController, | ||
controllerAs: 'vm', | ||
template: | ||
'<span class="help-inline" style="display: block;" ng-if="vm.passwordTip" ng-bind-html="vm.passwordTip">{{vm.passwordTip}}</span>', | ||
bindings: { | ||
passwordVal: "<", | ||
minPwdLength: "<", | ||
minPwdNonAlphaNum: "<" | ||
} | ||
}); | ||
|
||
function UmbPasswordTipController(localizationService) { | ||
|
||
let defaultMinPwdLength = Umbraco.Sys.ServerVariables.umbracoSettings.minimumPasswordLength; | ||
let defaultMinPwdNonAlphaNum = Umbraco.Sys.ServerVariables.umbracoSettings.minimumPasswordNonAlphaNum; | ||
|
||
var vm = this; | ||
vm.$onInit = onInit; | ||
vm.$onChanges = onChanges; | ||
|
||
function onInit() { | ||
if (vm.minPwdLength === undefined) { | ||
vm.minPwdLength = defaultMinPwdLength; | ||
} | ||
|
||
if (vm.minPwdNonAlphaNum === undefined) { | ||
vm.minPwdNonAlphaNum = defaultMinPwdNonAlphaNum; | ||
} | ||
|
||
if (vm.minPwdNonAlphaNum > 0) { | ||
localizationService.localize('user_newPasswordFormatNonAlphaTip', [vm.minPwdNonAlphaNum]).then(data => { | ||
vm.passwordNonAlphaTip = data; | ||
updatePasswordTip(0); | ||
}); | ||
} else { | ||
vm.passwordNonAlphaTip = ''; | ||
updatePasswordTip(0); | ||
} | ||
} | ||
|
||
function onChanges(simpleChanges) { | ||
if (simpleChanges.passwordVal) { | ||
if (simpleChanges.passwordVal.currentValue) { | ||
updatePasswordTip(simpleChanges.passwordVal.currentValue.length); | ||
} else { | ||
updatePasswordTip(0); | ||
} | ||
} | ||
} | ||
|
||
const updatePasswordTip = passwordLength => { | ||
const remainingLength = vm.minPwdLength - passwordLength; | ||
if (remainingLength > 0) { | ||
localizationService.localize('user_newPasswordFormatLengthTip', [remainingLength]).then(data => { | ||
vm.passwordTip = data; | ||
if (vm.passwordNonAlphaTip) { | ||
vm.passwordTip += `<br/>${vm.passwordNonAlphaTip}`; | ||
} | ||
}); | ||
} else { | ||
vm.passwordTip = vm.passwordNonAlphaTip; | ||
} | ||
} | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters