Merge pull request #4203 from christianbeeznest/storm-19778-2

User registration : Allow to use value as email in input username - BT#19778
pull/4334/head
Yannick Warnier 2 years ago committed by GitHub
commit 04f2f837bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      public/main/inc/lib/api.lib.php
  2. 3
      public/main/inc/lib/usermanager.lib.php

@ -294,7 +294,7 @@ define('LOG_SURVEY_ID', 'survey_id');
define('LOG_SURVEY_CREATED', 'survey_created');
define('LOG_SURVEY_DELETED', 'survey_deleted');
define('LOG_SURVEY_CLEAN_RESULTS', 'survey_clean_results');
define('USERNAME_PURIFIER', '/[^0-9A-Za-z_\.\$-]/');
define('USERNAME_PURIFIER', '/[^0-9A-Za-z_\.@\$-]/');
//used when login_is_email setting is true
define('USERNAME_PURIFIER_MAIL', '/[^0-9A-Za-z_\.@]/');

@ -1387,6 +1387,9 @@ class UserManager
$return = 'true' === api_get_setting('login_is_email') ? substr(preg_replace(USERNAME_PURIFIER_MAIL, '', $username), 0, User::USERNAME_MAX_LENGTH) : substr(preg_replace(USERNAME_PURIFIER, '', $username), 0, User::USERNAME_MAX_LENGTH);
$return = URLify::transliterate($return);
// We want everything transliterate() does except converting @ to '(at)'. This is a hack to avoid this.
$return = str_replace(' (at) ', '@', $return);
return $return;
}

Loading…
Cancel
Save