Skip to content

Commit

Permalink
fixing user model dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
df-arif committed Jun 18, 2015
1 parent 9c52c6e commit 552c435
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions app/Http/Controllers/SplashController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Carbon\Carbon;
use DreamFactory\Core\OAuth\Services\BaseOAuthService;
use DreamFactory\Core\Utility\ServiceHandler;
use DreamFactory\Core\Models\User as DspUser;
use DreamFactory\Core\ADLdap\Services\LDAP as LdapService;
use DreamFactory\Core\ADLdap\Contracts\Provider as ADLdapProvider;
use DreamFactory\Core\Utility\Session;
Expand Down Expand Up @@ -80,11 +79,12 @@ public static function handleADLdapLogin($provider)

if ($auth) {
$ldapUser = $driver->getUser();

$user = DspUser::createShadowADLdapUser($ldapUser, $service);
$user = $service->createShadowADLdapUser($ldapUser);
$user->update(['last_login_date' => Carbon::now()->toDateTimeString()]);

\Auth::login($user, \Request::has('remember'));
Session::setUserInfo($user);
Session::forgetApiKeys();

return redirect()->intended(env('LANDING_PAGE', '/launchpad'));
}
Expand Down Expand Up @@ -119,10 +119,12 @@ public function handleOAuthCallback($serviceName)
/** @var User $user */
$user = $driver->user();

$dspUser = DspUser::createShadowOAuthUser($user, $service);
$dspUser->update(['last_login_date' => Carbon::now()->toDateTimeString()]);
$dfUser = $service->createShadowOAuthUser($user);
$dfUser->update(['last_login_date' => Carbon::now()->toDateTimeString()]);

\Auth::login($dspUser);
\Auth::login($dfUser);
Session::setUserInfo($dfUser);
Session::forgetApiKeys();

if (\Request::ajax()) {
return ['success' => true, 'session_id' => Session::getId()];
Expand Down

0 comments on commit 552c435

Please sign in to comment.