Frontend service key name regex check
- Name is checked in the create preshared key form - Edit friendly name keep prompting until user enters a key that passes regex
This commit is contained in:
parent
2a1d226684
commit
97f06e3628
2 changed files with 13 additions and 2 deletions
|
@ -316,9 +316,9 @@
|
|||
<tr>
|
||||
<td><label for="create-key-name">Key Name:</label></td>
|
||||
<td>
|
||||
<input class="form-control" name="create-key-name" type="text" ng-model="newKey.name" placeholder="Friendly Key Name" required>
|
||||
<input class="form-control" name="create-key-name" type="text" ng-model="newKey.name" placeholder="Friendly Key Name" ng-pattern="/^[\s a-zA-Z0-9\-_:/]*$/" required>
|
||||
<span class="co-help-text">
|
||||
A friendly name for the key for later reference.
|
||||
A friendly name for the key for later reference. Must match ^[\s a-zA-Z0-9\-_:/]*$.
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -102,6 +102,17 @@ angular.module('quay').directive('serviceKeysManager', function () {
|
|||
'value': key.name || '',
|
||||
'callback': function(value) {
|
||||
if (value != null) {
|
||||
if (!value.match(/^[\s a-zA-Z0-9\-_:/]*$/)){
|
||||
bootbox.alert({
|
||||
'message': 'Invalid friendly name: input does not match <code>^[\\s a-zA-Z0-9\-_:/]*$</code>',
|
||||
'callback': function(){
|
||||
$scope.showChangeName(key)
|
||||
}
|
||||
});
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
var data = {
|
||||
'name': value
|
||||
};
|
||||
|
|
Reference in a new issue