Skip to content

Commit

Permalink
Issue #14: validate router name
Browse files Browse the repository at this point in the history
handle router name length
  • Loading branch information
geirkairam committed Nov 10, 2015
1 parent 897880d commit ec884bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 9 additions & 3 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ <h2>
name="routerName"
placeholder="{{'basicRouterSetup.routerName.placeholder' | translate }}"
data-ng-model="wizard.router.name"
required pattern="[A-Za-z0-9_\-]{0,16}"
required pattern="[A-Za-z0-9_\-]*"
data-ng-minlength="3"
data-ng-maxlength="32"
>
<span class="fa form-control-feedback"
ng-class="formControlFeedback('routerName')"></span>
Expand All @@ -91,11 +93,15 @@ <h2>
<div ng-show="wizardForm.routerName.$error.required" translate>
.routerName.error.required
</div>
</div>
<div class="help-block" ng-show="hasError('routerName')">
<div ng-show="wizardForm.routerName.$error.pattern" translate>
.routerName.error.pattern
</div>
<div ng-show="wizardForm.routerName.$error.maxlength" translate>
.routerName.error.maxLength
</div>
<div ng-show="wizardForm.routerName.$error.minlength" translate>
.routerName.error.minLength
</div>
</div>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion src/nls/locale-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"label": "Router name",
"error": {
"required": "This field is required.",
"pattern":"Special Characters are not allowed."
"pattern": "Special Characters are not allowed.",
"maxLength": "Max Characters 36",
"minLength": "Min Characters 3"
},
"help": "The router name is needed for ip registration and VPN cert and key generation. Also this name is visible in the <a href=\"http://map.berlin.freifunk.net\">Freifunk map</a> if you decide to share your location.",
"placeholder": "example: funkenpumpe3000"
Expand Down

0 comments on commit ec884bd

Please sign in to comment.