mirror of
https://github.com/bitwarden/web
synced 2025-12-06 00:03:28 +00:00
Password rules for registration and change.
This commit is contained in:
@@ -11,8 +11,21 @@ angular
|
|||||||
|
|
||||||
$scope.registerPromise = null;
|
$scope.registerPromise = null;
|
||||||
$scope.register = function (form) {
|
$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) {
|
if ($scope.model.masterPassword !== $scope.model.confirmMasterPassword) {
|
||||||
validationService.addError(form, 'ConfirmMasterPassword', 'Master password confirmation does not match.', true);
|
validationService.addError(form, 'ConfirmMasterPassword', 'Master password confirmation does not match.', true);
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,22 @@
|
|||||||
cryptoService, authService, cipherService, validationService, $q, toastr, $analytics) {
|
cryptoService, authService, cipherService, validationService, $q, toastr, $analytics) {
|
||||||
$analytics.eventTrack('settingsChangePasswordController', { category: 'Modal' });
|
$analytics.eventTrack('settingsChangePasswordController', { category: 'Modal' });
|
||||||
$scope.save = function (model, form) {
|
$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) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user