mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-22 11:45:59 +01:00
Password rules for registration and change.
This commit is contained in:
parent
70dc680dc9
commit
abe6ff074b
@ -11,8 +11,21 @@ angular
|
||||
|
||||
$scope.registerPromise = null;
|
||||
$scope.register = function (form) {
|
||||
var error = false;
|
||||
|
||||
if ($scope.model.masterPassword.length < 8 || !/[a-z]/i.test($scope.model.masterPassword) ||
|
||||
/^[a-zA-Z]*$/.test($scope.model.masterPassword)) {
|
||||
validationService.addError(form, 'MasterPassword',
|
||||
'Master password must be at least 8 characters long and contain at least 1 letter and 1 number ' +
|
||||
'or special character.', true);
|
||||
error = true;
|
||||
}
|
||||
if ($scope.model.masterPassword !== $scope.model.confirmMasterPassword) {
|
||||
validationService.addError(form, 'ConfirmMasterPassword', 'Master password confirmation does not match.', true);
|
||||
error = true;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,22 @@
|
||||
cryptoService, authService, cipherService, validationService, $q, toastr, $analytics) {
|
||||
$analytics.eventTrack('settingsChangePasswordController', { category: 'Modal' });
|
||||
$scope.save = function (model, form) {
|
||||
var error = false;
|
||||
|
||||
if ($scope.model.newMasterPassword.length < 8 || !/[a-z]/i.test($scope.model.newMasterPassword) ||
|
||||
/^[a-zA-Z]*$/.test($scope.model.newMasterPassword)) {
|
||||
validationService.addError(form, 'NewMasterPasswordHash',
|
||||
'Master password must be at least 8 characters long and contain at least 1 letter and 1 number ' +
|
||||
'or special character.', true);
|
||||
error = true;
|
||||
}
|
||||
if ($scope.model.newMasterPassword !== $scope.model.confirmNewMasterPassword) {
|
||||
validationService.addError(form, 'ConfirmNewMasterPassword', 'New master password confirmation does not match.', true);
|
||||
validationService.addError(form, 'ConfirmNewMasterPasswordHash',
|
||||
'New master password confirmation does not match.', true);
|
||||
error = true;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user