mirror of https://gitlab.crans.org/nounous/nixos
39 lines
1.8 KiB
Diff
39 lines
1.8 KiB
Diff
diff --git a/src/WSOAuth.php b/src/WSOAuth.php
|
|
index 3a94c87..e077b9e 100644
|
|
--- a/src/WSOAuth.php
|
|
+++ b/src/WSOAuth.php
|
|
@@ -308,11 +308,12 @@ class WSOAuth extends PluggableAuth {
|
|
// Set $realname and $email to the values returned from the authentication provider, if they are available
|
|
$realname = $remoteUserInfo['realname'] ?? null;
|
|
$email = $remoteUserInfo['email'] ?? null;
|
|
+ $username = ucfirst( $remoteUserInfo['name'] );
|
|
|
|
- $remoteUsername = ucfirst( $remoteUserInfo['name'] );
|
|
- $localUserId = $this->getLocalAccountID( $remoteUsername );
|
|
+ $remoteUserId = $remoteUserInfo['remoteUserId'] ?? $username;
|
|
+ $localUserId = $this->getLocalAccountID( $remoteUserId );
|
|
|
|
- $this->session->set( self::WSOAUTH_REMOTE_USERNAME_SESSION_KEY, $remoteUsername );
|
|
+ $this->session->set( self::WSOAUTH_REMOTE_USERNAME_SESSION_KEY, $remoteUserId );
|
|
$this->session->save();
|
|
|
|
if ( $localUserId !== 0 ) {
|
|
@@ -326,7 +327,7 @@ class WSOAuth extends PluggableAuth {
|
|
$currentUser = RequestContext::getMain()->getUser();
|
|
$currentUserId = $currentUser->getId();
|
|
|
|
- $this->createMapping( $currentUserId, $remoteUsername );
|
|
+ $this->createMapping( $currentUserId, $remoteUserId );
|
|
|
|
// Log the account in like normal
|
|
$username = $currentUser->getName();
|
|
@@ -339,7 +340,7 @@ class WSOAuth extends PluggableAuth {
|
|
throw new ContinuationException( wfMessage( "wsoauth-remote-only-accounts-disabled" )->parse() );
|
|
}
|
|
|
|
- $desiredLocalUsername = $this->useRealNameAsUsername && $realname !== null ? $realname : $remoteUsername;
|
|
+ $desiredLocalUsername = $this->useRealNameAsUsername && $realname !== null ? $realname : $username;
|
|
$userId = User::newFromName( $desiredLocalUsername )->idForName();
|
|
|
|
if ( $userId > 0 && $this->migrateUsersByUsername ) {
|