Fix username and groupname min length

This commit is contained in:
Girish Ramakrishnan
2017-02-02 01:10:01 -08:00
parent 7efb6d60bc
commit 7812c0e5c2
3 changed files with 4 additions and 3 deletions

View File

@@ -791,12 +791,13 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification',
Client.prototype.createUser = function (username, email, displayName, sendInvite, callback) {
var data = {
username: username,
email: email,
displayName: displayName,
invite: !!sendInvite
};
if (username !== null) data.username = username;
post('/api/v1/users', data).success(function(data, status) {
if (status !== 201 || typeof data !== 'object') return callback(new ClientError(status, data));
callback(null, data);

View File

@@ -164,7 +164,7 @@
<small ng-show="groupAddForm.name.$error.maxlength">The name is too long</small>
<small ng-show="!groupAddForm.name.$dirty && groupAdd.error.name">{{ groupAdd.error.name }}</small>
</div>
<input type="text" class="form-control" ng-model="groupAdd.name" id="groupAddName" name="name" ng-maxlength="200" ng-minlength="2" required autofocus>
<input type="text" class="form-control" ng-model="groupAdd.name" id="groupAddName" name="name" ng-maxlength="200" ng-minlength="1" required autofocus>
</div>
<input class="hide" type="submit" ng-disabled="groupAddForm.$invalid || groupAdd.busy"/>
</form>

View File

@@ -87,7 +87,7 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
$scope.useradd.error.username = null;
$scope.useradd.error.displayName = null;
Client.createUser($scope.useradd.username, $scope.useradd.email, $scope.useradd.displayName, $scope.useradd.sendInvite, function (error) {
Client.createUser($scope.useradd.username || null, $scope.useradd.email, $scope.useradd.displayName, $scope.useradd.sendInvite, function (error) {
$scope.useradd.busy = false;
if (error && error.statusCode === 409) {