Merge pull request #4055 from ssilvert/regex-trunc

KEYCLOAK-4402: Fix regexp password policy.
This commit is contained in:
Stian Thorgersen 2017-04-21 09:46:00 +02:00 committed by GitHub
commit e85d8774da

View file

@ -468,12 +468,14 @@ module.controller('RealmPasswordPolicyCtrl', function($scope, Realm, realm, $htt
value = null;
} else {
id = policyToken.substring(0, policyToken.indexOf('('));
value = policyToken.substring(policyToken.indexOf('(') + 1, policyToken.indexOf(')')).trim();
value = policyToken.substring(policyToken.indexOf('(') + 1, policyToken.lastIndexOf(')')).trim();
}
for (var j = 0; j < serverInfo.passwordPolicies.length; j++) {
if (serverInfo.passwordPolicies[j].id == id) {
var p = serverInfo.passwordPolicies[j];
// clone
var p = JSON.parse(JSON.stringify(serverInfo.passwordPolicies[j]));
p.value = value && value || p.defaultValue;
policies.push(p);
}
@ -502,6 +504,7 @@ module.controller('RealmPasswordPolicyCtrl', function($scope, Realm, realm, $htt
$scope.serverInfo = serverInfo;
$scope.changed = false;
console.log(JSON.stringify(parse(realm.passwordPolicy)));
$scope.policy = parse(realm.passwordPolicy);
var oldCopy = angular.copy($scope.policy);