mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-04 05:54:34 -04:00
Fixes for correct way to change an auth'd contact (#3708)
This commit is contained in:
parent
84a64773a6
commit
2000795fdc
@ -15,6 +15,7 @@ namespace App\Http\Controllers\ClientPortal;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\ClientContact;
|
use App\Models\ClientContact;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
class SwitchCompanyController extends Controller
|
class SwitchCompanyController extends Controller
|
||||||
{
|
{
|
||||||
@ -27,7 +28,7 @@ class SwitchCompanyController extends Controller
|
|||||||
->where('id', $this->transformKeys($contact))
|
->where('id', $this->transformKeys($contact))
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
auth('contact')->login($client_contact, true);
|
Auth::guard('contact')->login($client_contact, true);
|
||||||
|
|
||||||
return back();
|
return back();
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class BaseMailerJob implements ShouldQueue
|
|||||||
$user = User::find($sending_user);
|
$user = User::find($sending_user);
|
||||||
|
|
||||||
$google = (new Google())->init();
|
$google = (new Google())->init();
|
||||||
$google->getClient()->setAccessToken($user->oauth_user_token);
|
$google->getClient()->setAccessToken(json_encode($user->oauth_user_token));
|
||||||
|
|
||||||
if ($google->getClient()->isAccessTokenExpired()) {
|
if ($google->getClient()->isAccessTokenExpired()) {
|
||||||
$google->refreshToken($user);
|
$google->refreshToken($user);
|
||||||
@ -52,7 +52,7 @@ class BaseMailerJob implements ShouldQueue
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Config::set('mail.driver', 'gmail');
|
Config::set('mail.driver', 'gmail');
|
||||||
Config::set('services.gmail.token', $user->oauth_user_token['access_token']);
|
Config::set('services.gmail.token', $user->oauth_user_token->access_token);
|
||||||
|
|
||||||
(new MailServiceProvider(app()))->register();
|
(new MailServiceProvider(app()))->register();
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'oauth_user_token' => 'array',
|
'oauth_user_token' => 'object',
|
||||||
'settings' => 'object',
|
'settings' => 'object',
|
||||||
'updated_at' => 'timestamp',
|
'updated_at' => 'timestamp',
|
||||||
'created_at' => 'timestamp',
|
'created_at' => 'timestamp',
|
||||||
|
@ -15,6 +15,7 @@ class AddGoogleRefreshTokenToUsersTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->string('oauth_user_refresh_token')->nullable();
|
$table->string('oauth_user_refresh_token')->nullable();
|
||||||
|
$table->text('oauth_user_token')->change();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user