Skip to content

Commit

Permalink
Merge pull request #22 from jan-stanek/oprava-uppercase
Browse files Browse the repository at this point in the history
Oprava chyby s velkými písmeny v username
  • Loading branch information
Jan Staněk committed Apr 23, 2018
2 parents 7a33dc2 + a97b854 commit 852afd2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions auth.php
Expand Up @@ -107,9 +107,7 @@ public function trustExternal($user, $pass, $sticky = FALSE)

$name = $skautIsFirstName . ' ' . $skautIsLastName . ($skautIsNickName ? ' - ' . $skautIsNickName : '');

$login = iconv('UTF-8', 'ASCII//TRANSLIT', $skautIsUserName);
$login = preg_replace('/[^a-zA-Z0-9_]/', '', $login);
$login = $login . $userDetail->ID;
$login = $this->cleanUserName($skautIsUserName, $userDetail->ID);

$udata = $this->getUserData($login);

Expand Down Expand Up @@ -181,4 +179,11 @@ function isUserValid($login)
{
return isset($this->users[$login]) ? TRUE : FALSE;
}

function cleanUserName($skautIsUserName, $skautIsUserId)
{
$login = iconv('UTF-8', 'ASCII//TRANSLIT', $skautIsUserName);
$login = strtolower(preg_replace('/[^a-zA-Z0-9_]/', '', $login));
return $login . $skautIsUserId;
}
}

0 comments on commit 852afd2

Please sign in to comment.