当管理员在密码字段的开头或结尾输入空格时,我想显示一条错误消息。但我注意到,当我单击重置按钮时,返回的密码会自动删除字符串开头或结尾的空格。仅检测到中间的空格。
<legend><span class="text ng-binding">Manage Password</span></legend>
<div class="form-group">
<label class="col-md-2 control-label ng-binding" for="newPas">New Password
<span class="required ng-hide" data-ng-show="create">*</span></label>
<div class="col-md-6">
<input class="form-control password-conceal ng-not-empty ng-dirty ng-valid-parse
ng-valid ng-valid-required ng-touched" kc-password="" type="text" id="newPas"
name="newPas" data-ng-model="password" required="">
但是当我在 keycloak 文件上搜索它时,我发现它们是不同的。
<legend><span class="text">{{:: 'manage-user-password' | translate}}</span></legend>
<div class="form-group">
<label class="col-md-2 control-label" for="newPas">{{:: 'new-password' | translate}}
<span class="required" data-ng-show="create">*</span></label>
<div class="col-md-6">
<input class="form-control" kc-password type="text"
id="newPas" name="newPas" data-ng-model="password" required>
这是它使用的 angularjs 代码:
$scope.resetPassword = function() {
// hit enter without entering both fields - ignore
if (!$scope.passwordAndConfirmPasswordEntered()) return;
if ($scope.pwdChange) {
if ($scope.password != $scope.confirmPassword) {
Notifications.error("Password and confirmation does not match.");
return;
}
}
var msgTitle = 'Change password';
var msg = 'Are you sure you want to change the users password?';
Dialog.confirm(msgTitle, msg, function() {
UserCredentials.resetPassword({ realm: realm.realm, userId: user.id },
{ type : "password", value : $scope.password, temporary: $scope.temporaryPassword }, function() {
Notifications.success("The password has been reset test"+$scope.password);
//here i confirmed that the returned password automatically removes the spaces in beginning and end.
Only spaces in between are accepted.
$scope.password = null;
$scope.confirmPassword = null;
$route.reload();
});
}, function() {
$scope.password = null;
$scope.confirmPassword = null;
});
};
$scope.passwordAndConfirmPasswordEntered = function() {
return $scope.password && $scope.confirmPassword;
}
请帮助我找到keycloak如何删除我在密码开头或结尾输入的空格!谢谢