Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
normalize email with lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Spearrin committed Oct 11, 2016
1 parent 440032e commit d49d227
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/Web/wwwroot/app/accounts/accountsRegisterController.js
Expand Up @@ -26,10 +26,11 @@ angular
return;
}

var key = cryptoService.makeKey($scope.model.masterPassword, $scope.model.email);
var email = $scope.model.email.toLowerCase();
var key = cryptoService.makeKey($scope.model.masterPassword, email);
var request = {
name: $scope.model.name,
email: $scope.model.email,
email: email,
masterPasswordHash: cryptoService.hashPassword($scope.model.masterPassword, key),
masterPasswordHint: $scope.model.masterPasswordHint
};
Expand Down
1 change: 1 addition & 0 deletions src/Web/wwwroot/app/services/authService.js
Expand Up @@ -6,6 +6,7 @@ angular
_userProfile = null;

_service.logIn = function (email, masterPassword) {
email = email.toLowerCase();
var key = cryptoService.makeKey(masterPassword, email);

var request = {
Expand Down
7 changes: 4 additions & 3 deletions src/Web/wwwroot/app/settings/settingsChangeEmailController.js
Expand Up @@ -9,14 +9,15 @@

$scope.token = function (model) {
_masterPasswordHash = cryptoService.hashPassword(model.masterPassword);
var newEmail = model.newEmail.toLowerCase();

var request = {
newEmail: model.newEmail,
newEmail: newEmail,
masterPasswordHash: _masterPasswordHash
};

$scope.tokenPromise = apiService.accounts.emailToken(request, function () {
_newKey = cryptoService.makeKey(model.masterPassword, model.newEmail);
_newKey = cryptoService.makeKey(model.masterPassword, newEmail);
_newMasterPasswordHash = cryptoService.hashPassword(model.masterPassword, _newKey);

$scope.tokenSent = true;
Expand All @@ -41,7 +42,7 @@
$q.all([sitesPromise, foldersPromise]).then(function () {
var request = {
token: model.token,
newEmail: model.newEmail,
newEmail: model.newEmail.toLowerCase(),
masterPasswordHash: _masterPasswordHash,
newMasterPasswordHash: _newMasterPasswordHash,
ciphers: reencryptedSites.concat(reencryptedFolders)
Expand Down
Expand Up @@ -25,7 +25,7 @@
$scope.processing = true;

var profile = authService.getUserProfile();
var newKey = cryptoService.makeKey(model.newMasterPassword, profile.email);
var newKey = cryptoService.makeKey(model.newMasterPassword, profile.email.toLowerCase());

var reencryptedSites = [];
var sitesPromise = apiService.sites.list({ dirty: false }, function (encryptedSites) {
Expand Down

0 comments on commit d49d227

Please sign in to comment.