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

This commit is contained in:
Ralf Becker 2014-09-04 07:41:58 +00:00
parent 41e8331edd
commit 5661201ee1
2 changed files with 2 additions and 3 deletions

View File

@ -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 = {

View File

@ -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