Skip to content

Commit

Permalink
Implemented requested changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
spitfire305 committed Feb 8, 2024
1 parent 5cdcf0f commit 7c156ba
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions app/Http/Controllers/Settings/SubscriptionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ public function change(Request $request, Tier $tier)
}
$upgrade = $this->subscriptionUpgrade->user($user)->tier($tier)->upgradePrice($period);
$currency = $user->currencySymbol();

$this->emailValidation->user($user)->requiresEmail();
$validationService = false;
if ($user->isFrauding()) {
$validationService = $this->emailValidation;
}

return view('settings.subscription.change', compact(
'tier',
Expand All @@ -114,6 +116,7 @@ public function change(Request $request, Tier $tier)
'hasPromo',
'limited',
'isYearly',
'validationService',
));
}

Expand Down
2 changes: 1 addition & 1 deletion app/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ public function hasUnread(): bool
public function isFrauding(): bool
{
// Fraud detection can be turned on or off
if (config('subscription.fraud_detection')) {
if (!config('subscription.fraud_detection')) {
return false;
}
// Someone with a provider (twitter, fb) login is always considered safe
Expand Down
5 changes: 4 additions & 1 deletion resources/views/settings/subscription/change.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
<article class="text-center max-w-xl container">

<x-grid type="1/1">
@if (!$user->isFrauding())
@if ($validationService)
@php
$validationService->user($user)->requiresEmail();
@endphp
<x-alert type="warning">
{{ __('emails/validation.modal') }}
</x-alert></div><?php return; ?>
Expand Down

0 comments on commit 7c156ba

Please sign in to comment.