Skip to content

Commit

Permalink
Fixed Serialization Problem
Browse files Browse the repository at this point in the history
  • Loading branch information
luke- committed May 22, 2024
1 parent 6c0ab7a commit 3e31e60
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 27 deletions.
45 changes: 19 additions & 26 deletions authclient/GithubAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,32 @@ protected function defaultViewOptions()
];
}

/**
* @inheritdoc
*/
protected function initUserAttributes()
{
$attributes = parent::initUserAttributes();

if (isset($attributes['name'])) {
$parts = mb_split(' ', $attributes['name'], 2);
if (isset($parts[0])) {
$attributes['firstname'] = $parts[0];
}
if (isset($parts[1])) {
$attributes['lastname'] = $parts[1];
}
}
return $attributes;
}

/**
* @inheritdoc
*/
protected function defaultNormalizeUserAttributeMap()
{
return [
'username' => 'login',
'firstname' => function ($attributes) {
if (!isset($attributes['name'])) {
return '';
}
$parts = mb_split(' ', $attributes['name'], 2);
if (isset($parts[0])) {
return $parts[0];
}
return '';
},
'lastname' => function ($attributes) {
if (!isset($attributes['name'])) {
return '';
}
$parts = mb_split(' ', $attributes['name'], 2);
if (isset($parts[1])) {
return $parts[1];
}
return '';
},
'email' => function ($attributes) {
if (empty($attributes['email'])) {
throw new NotFoundHttpException(Yii::t('AuthGithubModule.base', 'Please add a valid email address to your GitHub account to be able to proceed.'));
}
return $attributes['email'];
},
];
}
}
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

1.0.1 (May 22, 2024)
---------------------
- Fix: Serialization Problem

1.0.0 (March 2, 2022)
---------------------
- Initial release
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Integrating GitHub Sign-In (OAuth 2.0).",
"keywords": [
],
"version": "1.0.0",
"version": "1.0.1",
"homepage": "https://github.com/humhub-contrib/auth-github",
"humhub": {
"minVersion": "1.6"
Expand Down

0 comments on commit 3e31e60

Please sign in to comment.