mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-06 03:55:26 +00:00
fix(core): Require current password on password change (#285)
Increase security by requiring the current password when changing the password. This increases the security for cases such as XSS, or just a forgotten browser window left open. Fixes #4140
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
|
||||
this.$onInit = function() {
|
||||
this.preferences = Preferences;
|
||||
this.passwords = { newPassword: null, newPasswordConfirmation: null };
|
||||
this.passwords = { newPassword: null, newPasswordConfirmation: null, oldPassword: null };
|
||||
this.timeZonesList = $window.timeZonesList;
|
||||
this.timeZonesSearchText = '';
|
||||
this.sieveVariablesCapability = ($window.sieveCapabilities.indexOf('variables') >= 0);
|
||||
@@ -465,14 +465,15 @@
|
||||
this.canChangePassword = function() {
|
||||
if (this.passwords.newPassword && this.passwords.newPassword.length > 0 &&
|
||||
this.passwords.newPasswordConfirmation && this.passwords.newPasswordConfirmation.length &&
|
||||
this.passwords.newPassword == this.passwords.newPasswordConfirmation)
|
||||
this.passwords.newPassword == this.passwords.newPasswordConfirmation &&
|
||||
this.passwords.oldPassword && this.passwords.oldPassword.length > 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
this.changePassword = function() {
|
||||
Authentication.changePassword(this.passwords.newPassword).then(function() {
|
||||
Authentication.changePassword(this.passwords.newPassword, this.passwords.oldPassword).then(function() {
|
||||
var alert = $mdDialog.alert({
|
||||
title: l('Password'),
|
||||
content: l('The password was changed successfully.'),
|
||||
|
||||
Reference in New Issue
Block a user