Skip to content

Commit

Permalink
Added option to recheck/view custom domain records
Browse files Browse the repository at this point in the history
  • Loading branch information
willbrowningme committed Mar 8, 2021
1 parent 8213efa commit 95e4e61
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
6 changes: 1 addition & 5 deletions app/Http/Controllers/DomainVerificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@ class DomainVerificationController extends Controller
{
public function __construct()
{
$this->middleware('throttle:6,1');
$this->middleware('throttle:1,1');
}

public function checkSending($id)
{
$domain = user()->domains()->findOrFail($id);

if ($domain->isVerifiedForSending()) {
return response('Domain already verified for sending', 404);
}

return $domain->checkVerificationForSending();
}
}
2 changes: 1 addition & 1 deletion app/Models/Domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function checkVerification()

return collect(dns_get_record($this->domain . '.', DNS_TXT))
->contains(function ($r) {
return trim($r['txt']) === 'aa-verify=' . sha1(config('anonaddy.secret') . user()->id);
return trim($r['txt']) === 'aa-verify=' . sha1(config('anonaddy.secret') . user()->id . user()->domains->count());
});
}

Expand Down
31 changes: 24 additions & 7 deletions resources/js/pages/Domains.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,30 @@
/>
</span>
<span v-else-if="props.column.field === 'domain_sending_verified_at'">
<span
name="check"
v-if="props.row.domain_sending_verified_at"
class="py-1 px-2 bg-green-200 text-green-900 rounded-full text-xs"
>
verified
</span>
<div v-if="props.row.domain_sending_verified_at">
<svg
class="h-5 w-5 inline-block"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
>
<g fill="none" fill-rule="evenodd">
<circle class="text-green-200 fill-current" cx="10" cy="10" r="10"></circle>
<polyline
class="text-green-900 stroke-current"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
points="6 10 8.667 12.667 14 7.333"
></polyline>
</g>
</svg>
<button
@click="openCheckRecordsModal(rows[props.row.originalIndex])"
class="focus:outline-none text-sm ml-2"
>
Recheck
</button>
</div>
<button
v-else
@click="openCheckRecordsModal(rows[props.row.originalIndex])"
Expand Down
2 changes: 1 addition & 1 deletion resources/views/domains/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<div class="container py-8">
@include('shared.status')

<domains :initial-domains="{{json_encode($domains)}}" domain-name="{{config('anonaddy.domain')}}" hostname="{{config('anonaddy.hostname')}}" :recipient-options="{{ json_encode(Auth::user()->verifiedRecipients) }}" aa-verify="{{ sha1(config('anonaddy.secret') . Auth::user()->id) }}" />
<domains :initial-domains="{{json_encode($domains)}}" domain-name="{{config('anonaddy.domain')}}" hostname="{{config('anonaddy.hostname')}}" :recipient-options="{{ json_encode(Auth::user()->verifiedRecipients) }}" aa-verify="{{ sha1(config('anonaddy.secret') . Auth::user()->id . Auth::user()->domains->count()) }}" />
</div>
@endsection

0 comments on commit 95e4e61

Please sign in to comment.