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:
@@ -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;
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user