-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #249 from czqoocavatsim/development
Work
- Loading branch information
Showing
48 changed files
with
1,631 additions
and
1,071 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
APP_NAME="Gander Oceanic OCA" | ||
APP_ENV=local | ||
APP_KEY= | ||
APP_DEBUG=true | ||
APP_URL=http://ganderoceanic.test | ||
|
||
LOG_CHANNEL=discord | ||
LOG_DISCORD_WEBHOOK_URL= | ||
|
||
DB_CONNECTION=mysql | ||
DB_HOST=127.0.0.1 | ||
DB_PORT=3306 | ||
DB_DATABASE=test | ||
DB_USERNAME=root | ||
DB_PASSWORD= | ||
QUEUE_CONNECTION=sync | ||
|
||
#CTP Home page | ||
CTP_HOME_PAGE=false | ||
|
||
#If you want to send mail | ||
MAIL_DRIVER=smtp | ||
MAIL_HOST= | ||
MAIL_PORT= | ||
MAIL_USERNAME= | ||
MAIL_PASSWORD= | ||
|
||
#Channel IDs for Discord channels if you want them to work | ||
DISCORD_WEB_LOGS=753086414811562014 | ||
DISCORD_GUILD_LOGS=482860026831175690 | ||
DISCORD_ANNOUNCEMENTS=488265136696459292 | ||
DISCORD_ENDORSEMENTS=538938024470511648 | ||
DISCORD_MARKETING=557500419614703617 | ||
DISCORD_STAFF=536497946359758863 | ||
DISCORD_INSTRUCTORS=782927909974442015 | ||
|
||
#Discord OAuth keys for linking/server joining | ||
DISCORD_CLIENT_ID= | ||
DISCORD_CLIENT_SECRET= | ||
DISCORD_BOT_TOKEN= | ||
DISCORD_REDIRECT_URI=https://ganderoceanic.ca/my/discord/link/callback | ||
DISCORD_REDIRECT_URI_JOIN=https://ganderoceanic.ca/my/discord/server/join/callback | ||
DISCORD_GUILD_ID=479250337048297483 | ||
|
||
#VATSIM connect | ||
CONNECT_CLIENT_ID= | ||
CONNECT_SECRET= | ||
CONNECT_REDIRECT_URI="http://ganderoceanic.test/auth/connect/validate" | ||
|
||
#Spaces | ||
DIGITALOCEAN_SPACES_KEY= | ||
DIGITALOCEAN_SPACES_SECRET= | ||
DIGITALOCEAN_SPACES_ENDPOINT= | ||
DIGITALOCEAN_SPACES_REGION= | ||
DIGITALOCEAN_SPACES_BUCKET= | ||
|
||
QUOTES_API_TOKEN= | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
use App\Models\Users\User; | ||
use Illuminate\Support\Str; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Log; | ||
use App\Http\Controllers\Controller; | ||
use Illuminate\Support\Facades\Auth; | ||
use App\Models\Users\UserPreferences; | ||
|
@@ -76,14 +75,13 @@ public function validateConnectLogin(Request $request) | |
session()->put('token', json_decode((string) $response->getBody(), true)); | ||
|
||
try { | ||
$response = (new \GuzzleHttp\Client())->get(config('connect.endpoint').'/api/user', [ | ||
$response = (new Client())->get(config('connect.endpoint').'/api/user', [ | ||
'headers' => [ | ||
'Accept' => 'application/json', | ||
'Authorization' => 'Bearer '.session()->get('token.access_token'), | ||
], | ||
]); | ||
} catch (ClientException $e) { | ||
dd($e); | ||
return redirect()->route('index')->with('error-modal', $e->getMessage()); | ||
} | ||
$response = json_decode($response->getBody()); | ||
|
@@ -93,7 +91,7 @@ public function validateConnectLogin(Request $request) | |
if (!isset($response->data->vatsim->rating)) { | ||
return redirect()->route('index')->with('error-modal', 'We cannot create an account without VATSIM details.'); | ||
} | ||
User::updateOrCreate(['id' => $response->data->cid], [ | ||
$user = User::updateOrCreate(['id' => $response->data->cid], [ | ||
'email' => isset($response->data->personal->email) ? $response->data->personal->email : '[email protected]', | ||
'fname' => isset($response->data->personal->name_first) ? utf8_decode($response->data->personal->name_first) : $response->data->cid, | ||
'lname' => isset($response->data->personal->name_last) ? $response->data->personal->name_last : $response->data->cid, | ||
|
@@ -109,28 +107,28 @@ public function validateConnectLogin(Request $request) | |
'display_fname' => isset($response->data->personal->name_first) ? utf8_decode($response->data->personal->name_first) : $response->data->cid, | ||
'used_connect' => true, | ||
]); | ||
$user = User::find($response->data->cid); | ||
|
||
if ($user->wasRecentlyCreated) { | ||
UserPreferences::create([ | ||
'user_id' => $response->data->cid, | ||
'ui_mode' => 'light' | ||
]); | ||
UserNotificationPreferences::create([ | ||
'user_id' => $response->data->cid, | ||
]); | ||
UserPrivacyPreferences::create([ | ||
'user_id' => $response->data->cid | ||
]); | ||
} | ||
|
||
$user->genInitialAvatar(); | ||
|
||
if (!isset($response->data->personal->name_first)) { | ||
$user->display_cid_only = true; | ||
} | ||
|
||
$user->save(); | ||
Auth::login($user, true); | ||
if (!UserPreferences::where('user_id', $user->id)->first()) { | ||
$prefs = new UserPreferences(); | ||
$prefs->user_id = $user->id; | ||
$prefs->ui_mode = 'light'; | ||
$prefs->save(); | ||
} | ||
if (!UserPrivacyPreferences::where('user_id', $user->id)->first()) { | ||
$priv = new UserPrivacyPreferences(); | ||
$priv->user_id = $user->id; | ||
$priv->save(); | ||
} | ||
if (!UserNotificationPreferences::where('user_id', $user->id)->first()) { | ||
$notif = new UserNotificationPreferences(); | ||
$notif->user_id = $user->id; | ||
$notif->save(); | ||
} | ||
|
||
return redirect()->route('my.index')->with('success', "Welcome back, {$user->fullName('F')}!"); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.