Fix some minor things regarding link validation
This commit is contained in:
parent
8cd67a026d
commit
67f4a9ac84
@ -27,7 +27,7 @@ class LodestoneLinkingService
|
|||||||
|
|
||||||
public function getLinkDiscord($lodestoneId, $discordUserId) {
|
public function getLinkDiscord($lodestoneId, $discordUserId) {
|
||||||
// Check already linked
|
// Check already linked
|
||||||
if (UserLink::where('lodestoneId', $lodestoneId)->count() > 0) {
|
if (UserLink::where('lodestoneId', $lodestoneId)->where('discordUserId', $discordUserId)->count() > 0) {
|
||||||
return [
|
return [
|
||||||
'linked' => true,
|
'linked' => true,
|
||||||
'linkCode' => null,
|
'linkCode' => null,
|
||||||
@ -62,7 +62,7 @@ class LodestoneLinkingService
|
|||||||
|
|
||||||
public function getLinkWebsite($lodestoneId, $hostname, $websiteUserId) {
|
public function getLinkWebsite($lodestoneId, $hostname, $websiteUserId) {
|
||||||
// Check already linked
|
// Check already linked
|
||||||
if (UserLink::where('lodestoneId', $lodestoneId)->count() > 0) {
|
if (UserLink::where('lodestoneId', $lodestoneId)->where('websiteUserId', $websiteUserId)->count() > 0) {
|
||||||
return [
|
return [
|
||||||
'linked' => true,
|
'linked' => true,
|
||||||
'linkCode' => null,
|
'linkCode' => null,
|
||||||
@ -79,7 +79,7 @@ class LodestoneLinkingService
|
|||||||
} else {
|
} else {
|
||||||
if ($linkCode !== null)
|
if ($linkCode !== null)
|
||||||
$linkCode->delete();
|
$linkCode->delete();
|
||||||
$code = $this->codeGeneratorService->generateCode('discord');
|
$code = $this->codeGeneratorService->generateCode('website');
|
||||||
$linkCode = LinkCode::create([
|
$linkCode = LinkCode::create([
|
||||||
'lodestoneId' => $lodestoneId,
|
'lodestoneId' => $lodestoneId,
|
||||||
'websiteHostname' => $hostname,
|
'websiteHostname' => $hostname,
|
||||||
|
|||||||
@ -17,7 +17,7 @@ class CreateUserLinksTable extends Migration
|
|||||||
$table->id();
|
$table->id();
|
||||||
$table->bigInteger('lodestoneId')->unsigned()->unique();
|
$table->bigInteger('lodestoneId')->unsigned()->unique();
|
||||||
$table->bigInteger('discordUserId')->unsigned()->nullable()->unique();
|
$table->bigInteger('discordUserId')->unsigned()->nullable()->unique();
|
||||||
$table->bigInteger('websiteHostname')->unsigned()->nullable();
|
$table->string('websiteHostname', 255)->nullable();
|
||||||
$table->bigInteger('websiteUserId')->unsigned()->nullable();
|
$table->bigInteger('websiteUserId')->unsigned()->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user