Skip to content

Commit 1952cac

Browse files
committed
fix: salvataggio configurazione oauth2
1 parent ab8996b commit 1952cac

6 files changed

Lines changed: 25 additions & 3 deletions

File tree

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
if ($dbo->isConnected()) {
3333
try {
34-
$microsoft = $dbo->selectOne('zz_oauth2', '*', ['nome' => 'Microsoft', 'enabled' => 1, 'is_login' => 1]);
34+
$microsoft = $dbo->selectOne('zz_oauth2', '*', ['name' => 'Microsoft', 'enabled' => 1, 'is_login' => 1]);
3535
} catch (QueryException $e) {
3636
}
3737
}

modules/emails/src/OAuth2/Google.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
class Google extends OriginalProvider implements ProviderInterface
88
{
9+
10+
protected static $provider = 'Google';
911
protected static $options = [
1012
'scope' => ['https://mail.google.com/'],
1113
'access_type' => 'offline',
@@ -35,4 +37,10 @@ protected function getDefaultScopes(): array
3537
{
3638
return ['https://mail.google.com/'];
3739
}
40+
41+
public static function getName()
42+
{
43+
return static::$provider;
44+
}
45+
3846
}

modules/emails/src/OAuth2/Microsoft.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
class Microsoft extends Azure implements ProviderInterface
88
{
9+
10+
protected static $provider = 'Microsoft';
11+
912
/**
1013
* Impostazioni native per la connessione.
1114
*
@@ -51,4 +54,9 @@ public static function getConfigInputs()
5154
],
5255
];
5356
}
57+
58+
public static function getName()
59+
{
60+
return static::$provider;
61+
}
5462
}

modules/oauth/edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<div class="card-body">
3333
<div class="row">
3434
<div class="col-md-6">
35-
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "nome", "value": "$nome$", "disabled": "1" ]}
35+
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "name", "value": "$name$", "disabled": "1" ]}
3636
</div>
3737

3838
<div class="col-md-6">

modules/smtp/actions.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@
7878
}
7979
// Aggiornamento delle informazioni per OAuth2
8080
else {
81-
$oauth2 = $account->oauth2 ?: OAuth2::build();
81+
$provider_name = '';
82+
if (class_exists(post('provider'))) {
83+
$provider = new(post('provider'));
84+
$provider_name = $provider->getName();
85+
}
86+
$oauth2 = $account->oauth2 ?: OAuth2::build($provider_name);
8287

8388
$oauth2->class = post('provider');
8489
$oauth2->client_id = post('client_id');

update/2_9_8.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE `zz_oauth2` CHANGE `nome` `name` VARCHAR(255) NOT NULL;

0 commit comments

Comments
 (0)