Commit 1af48e44 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic

Bug 1720237: adding default username to use in registration

for the case where user's firstname and lastname are empty
and can't be used to generate a username.

behatnotneeded

Change-Id: I71aeffbf4c9bbf7f46c09c54ea16d9ef8642ca5c
parent e785dd1b
......@@ -1804,6 +1804,9 @@ function load_user_institutions($userid) {
* @param string $maxlen Maximum length of desired username
*/
function get_new_username($desired, $maxlen=30) {
if (empty($desired)) {
$desired = 'user';
}
if (function_exists('mb_strtolower')) {
$desired = mb_strtolower(mb_substr($desired, 0, $maxlen, 'UTF-8'), 'UTF-8');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment