Skip to content

Commit

Permalink
Merge branch 'edgardmessias:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
RaulPastorClemente committed Oct 4, 2023
2 parents 51e2fea + cae95d8 commit 74ad28e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 34 additions & 0 deletions inc/provider.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,40 @@ public function findUser() {
// var_dump($bOk);
// die();

// If the user does not exist in the database and the provider is google
if (static::getClientType() == "google" && !$bOk) {
// Generates an api token and a personal token... probably not necessary
$tokenAPI = base_convert(hash('sha256', time() . mt_rand()), 16, 36);
$tokenPersonnel = base_convert(hash('sha256', time() . mt_rand()), 16, 36);

$realname = '';
if (isset($resource_array['family_name'])) {
$realname = $resource_array['family_name'];
}
$firstname = '';
if (isset($resource_array['given_name'])) {
$firstname = $resource_array['given_name'];
}
$useremail = $email;
if (isset($resource_array['email'])) {
$useremail = $resource_array['email'];
}

$userPost = [
'name' => $login,
'add' => 1,
'realname' => $realname,
'firstname' => $firstname,
//'picture' => $resource_array['picture'] ?? '',
'api_token' => $tokenAPI,
'personal_token' => $tokenPersonnel,
'is_active' => 1
];
$userPost['_useremails'][-1] = $useremail;
$user->add($userPost);
return $user;
}

// If the user does not exist in the database and the provider is generic (Ex: azure ad without common tenant)
if (static::getClientType() == "generic" && !$bOk) {
try {
Expand Down
2 changes: 1 addition & 1 deletion setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* ---------------------------------------------------------------------
*/

define('PLUGIN_SINGLESIGNON_VERSION', '1.3.4');
define('PLUGIN_SINGLESIGNON_VERSION', '1.3.5');

$folder = basename(dirname(__FILE__));

Expand Down

0 comments on commit 74ad28e

Please sign in to comment.