From 5661201ee1f6afbf92572c9756166d64ae0d71ee Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 4 Sep 2014 07:41:58 +0000 Subject: [PATCH] only generate default email address for new accounts, allows to set empty email address for existing accounts or by emptying it before save for new accounts --- addressbook/js/app.js | 1 - admin/inc/class.admin_account.inc.php | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/addressbook/js/app.js b/addressbook/js/app.js index cab4855dda..dff7f0acc1 100644 --- a/addressbook/js/app.js +++ b/addressbook/js/app.js @@ -670,7 +670,6 @@ app.classes.addressbook = AppJS.extend( case 'account_lid': case 'n_family': case 'n_given': - case 'email': case 'account_passwd_2': var values = this.et2._inst.getValues(this.et2); var data = { diff --git a/admin/inc/class.admin_account.inc.php b/admin/inc/class.admin_account.inc.php index 793d78fb32..907c98a704 100644 --- a/admin/inc/class.admin_account.inc.php +++ b/admin/inc/class.admin_account.inc.php @@ -250,8 +250,8 @@ class admin_account */ public static function ajax_check(array $data, $changed) { - // generate default email address - if (empty($data['account_email']) || !$data['account_id'] && in_array($changed, array('n_given', 'n_family'))) + // generate default email address, but only for new accounts + if (!$data['account_id'] && in_array($changed, array('n_given', 'n_family', 'account_lid'))) { $email = common::email_address($data['account_firstname'], $data['account_lastname'], $data['account_lid']); if ($email && $email[0] != '@' && strpos($email, '@')) // only add valid email addresses