Better handling of namespace validation to fix a number of issues

- Fixes a bug which allows for underscores at the beginning of namespaces: Fixes #1849
- Allows dots and dashes for newer Docker clients: Fixes #1188
- Has the UI display better messaging associated with namespace entry
This commit is contained in:
Joseph Schorr 2016-09-20 15:21:26 -04:00
parent efbbeeb07f
commit 3a68740ff7
11 changed files with 126 additions and 21 deletions

View file

@ -33,19 +33,22 @@
<!-- Step 2 -->
<div ng-show="user && !user.anonymous && !created">
<div class="step-container">
<div class="co-alert co-alert-danger" ng-if="createError">
{{ createError }}
</div>
<form method="post" name="newOrgForm" id="newOrgForm" ng-submit="createNewOrg()">
<div class="form-group nested">
<label for="orgName">Organization Name</label>
<div class="field-row">
<span class="field-container">
<input id="orgName" name="orgName" type="text" class="form-control"
placeholder="Organization Name"
ng-model="org.name" required autofocus data-trigger="manual"
data-content="{{ createError }}"
data-placement="bottom" data-container="body" ng-pattern="/^[a-z0-9_]{4,30}$/">
<span class="namespace-input" binding="org.name" is-back-incompat="isBackIncompat" namespace-title="Organization name"></span>
</span>
<span class="co-alert co-alert-warning thin" ng-show="!newOrgForm.orgName.$error.required && !newOrgForm.orgName.$valid">
Organization names must match [a-z0-9_]+ and be at least four characters in length.
<span class="co-alert co-alert-warning thin" ng-show="isBackIncompat">
Organization names with dots or dashes are incompatible with Docker verion 1.8 or older
</span>
<span class="co-alert co-alert-danger thin" ng-show="!newOrgForm.namespaceField.$error.required && newOrgForm.namespaceField.$invalid">
Organization names must be alphanumeric and be at least four characters in length
</span>
</div>
<span class="description">This will also be the namespace for your repositories. Must be alphanumeric, all lowercase and at least four characters long.</span>