1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-22 11:45:59 +01:00

Validation adjustments.

This commit is contained in:
Kyle Spearrin 2016-09-22 13:03:28 -04:00
parent 3d7b32f359
commit eef4d6f48e
11 changed files with 30 additions and 18 deletions

View File

@ -8,7 +8,11 @@
$scope.submitPromise = null;
$scope.submit = function (model) {
if (!model.email) {
toastr.error('Email is required.');
toastr.error('Email address is required.', 'Errors have occurred');
return;
}
if (model.email.indexOf('@') === -1) {
toastr.error('Invalid email address.', 'Errors have occurred');
return;
}

View File

@ -1,7 +1,7 @@
angular
.module('bit.accounts')
.controller('accountsLoginController', function ($scope, $state, $stateParams, loginService, userService) {
.controller('accountsLoginController', function ($scope, $state, $stateParams, loginService, userService, toastr) {
popupUtils.initListSectionItemListeners();
if ($stateParams.email) {
@ -18,11 +18,15 @@
$scope.loginPromise = null;
$scope.login = function (model) {
if (!model.email) {
toastr.error('Email is required.');
toastr.error('Email address is required.', 'Errors have occurred');
return;
}
if (model.email.indexOf('@') === -1) {
toastr.error('Invalid email address.', 'Errors have occurred');
return;
}
if (!model.masterPassword) {
toastr.error('Master password is required.');
toastr.error('Master password is required.', 'Errors have occurred');
return;
}

View File

@ -1,14 +1,14 @@
angular
.module('bit.accounts')
.controller('accountsLoginTwoFactorController', function ($scope, $state, loginService) {
.controller('accountsLoginTwoFactorController', function ($scope, $state, loginService, toastr) {
popupUtils.initListSectionItemListeners();
$('#code').focus();
$scope.loginPromise = null;
$scope.login = function (model) {
if (!model.code) {
toastr.error('Verification code is required.');
toastr.error('Verification code is required.', 'Errors have occurred');
return;
}

View File

@ -8,15 +8,19 @@
$scope.submitPromise = null;
$scope.submit = function (model) {
if (!model.email) {
toastr.error('Email is required.');
toastr.error('Email address is required.', 'Errors have occurred');
return;
}
if (model.email.indexOf('@') === -1) {
toastr.error('Invalid email address.', 'Errors have occurred');
return;
}
if (!model.masterPassword) {
toastr.error('Master password is required.');
toastr.error('Master password is required.', 'Errors have occurred');
return;
}
if (model.masterPassword !== model.masterPasswordRetype) {
toastr.error('Master password confirmation does not match.');
toastr.error('Master password confirmation does not match.', 'Errors have occurred');
return;
}

View File

@ -16,7 +16,7 @@
<div class="list-section-item list-section-item-icon-input">
<i class="fa fa-envelope fa-lg fa-fw"></i>
<label for="email" class="sr-only">Email Address</label>
<input id="email" type="email" name="Email" placeholder="Email Address" ng-model="model.email">
<input id="email" type="text" name="Email" placeholder="Email Address" ng-model="model.email">
</div>
</div>
<div class="list-section-footer">

View File

@ -16,7 +16,7 @@
<div class="list-section-item list-section-item-icon-input">
<i class="fa fa-envelope fa-lg fa-fw"></i>
<label for="email" class="sr-only">Email Address</label>
<input id="email" type="email" name="Email" placeholder="Email Address" ng-model="model.email">
<input id="email" type="text" name="Email" placeholder="Email Address" ng-model="model.email">
</div>
<div class="list-section-item list-section-item-icon-input">
<i class="fa fa-lock fa-lg fa-fw"></i>

View File

@ -16,7 +16,7 @@
<div class="list-section-item list-section-item-icon-input">
<i class="fa fa-envelope fa-lg fa-fw"></i>
<label for="email" class="sr-only">Email Address</label>
<input id="email" type="email" name="Email" placeholder="Email Address" ng-model="model.email">
<input id="email" type="text" name="Email" placeholder="Email Address" ng-model="model.email">
</div>
<div class="list-section-item list-section-item-icon-input">
<i class="fa fa-lock fa-lg fa-fw"></i>

View File

@ -8,7 +8,7 @@ angular
$scope.savePromise = null;
$scope.save = function (model) {
if (!model.name) {
toastr.error('Name is required.');
toastr.error('Name is required.', 'Errors have occurred');
return;
}

View File

@ -15,7 +15,7 @@
$scope.savePromise = null;
$scope.save = function (model) {
if (!model.name) {
toastr.error('Name is required.');
toastr.error('Name is required.', 'Errors have occurred');
return;
}

View File

@ -32,11 +32,11 @@
$scope.savePromise = null;
$scope.save = function (model) {
if (!model.name) {
toastr.error('Name is required.');
toastr.error('Name is required.', 'Errors have occurred');
return;
}
if (!model.password) {
toastr.error('Password is required.');
toastr.error('Password is required.', 'Errors have occurred');
return;
}

View File

@ -32,11 +32,11 @@ angular
$scope.savePromise = null;
$scope.save = function (model) {
if (!model.name) {
toastr.error('Name is required.');
toastr.error('Name is required.', 'Errors have occurred');
return;
}
if (!model.password) {
toastr.error('Password is required.');
toastr.error('Password is required.', 'Errors have occurred');
return;
}