1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-22 19:23:52 +00:00

login form styling. server validation errors displayed as sweet alerts

This commit is contained in:
Kyle Spearrin
2016-09-20 16:17:31 -04:00
parent 2fefdf8f6c
commit 47b500d7c0
11 changed files with 91 additions and 111 deletions

View File

@@ -1,30 +0,0 @@
angular
.module('bit.directives')
.directive('bitField', function () {
var linkFn = function (scope, element, attrs, ngModel) {
ngModel.$registerError = registerError;
ngModel.$validators.validate = validator;
function validator() {
ngModel.$setValidity('bit', true);
return true;
}
function registerError() {
ngModel.$setValidity('bit', false);
}
};
return {
require: 'ngModel',
restrict: 'A',
compile: function (elem, attrs) {
if (!attrs.name || attrs.name === '') {
throw 'bit-field element does not have a valid name attribute';
}
return linkFn;
}
};
});

View File

@@ -18,9 +18,6 @@
return;
}
// reset errors
form.$errors = null;
// start loading
form.$loading = true;
@@ -28,8 +25,7 @@
form.$loading = false;
}, function failure(reason) {
form.$loading = false;
validationService.addErrors(form, reason);
scope.$broadcast('show-errors-check-validity');
validationService.showError(reason);
});
}
});