mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Update ParentalControlsController, redirect to new custom error page on active session when attempting to use child invite link so as to not overwrite parent active session with child session
This commit is contained in:
parent
ef57d471e5
commit
319a20b473
2 changed files with 23 additions and 0 deletions
|
@ -87,7 +87,14 @@ class ParentalControlsController extends Controller
|
|||
|
||||
public function inviteRegister(Request $request, $id, $code)
|
||||
{
|
||||
if($request->user()) {
|
||||
$title = 'You cannot complete this action on this device.';
|
||||
$body = 'Please log out or use a different device or browser to complete the invitation registration.';
|
||||
return view('errors.custom', compact('title', 'body'));
|
||||
}
|
||||
|
||||
$this->authPreflight($request, true, false);
|
||||
|
||||
$pc = ParentalControls::whereRaw('verify_code = BINARY ?', $code)->whereNull(['email_verified_at', 'child_id'])->findOrFail($id);
|
||||
abort_unless(User::whereId($pc->parent_id)->exists(), 404);
|
||||
return view('settings.parental-controls.invite-register-form', compact('pc'));
|
||||
|
@ -95,6 +102,12 @@ class ParentalControlsController extends Controller
|
|||
|
||||
public function inviteRegisterStore(Request $request, $id, $code)
|
||||
{
|
||||
if($request->user()) {
|
||||
$title = 'You cannot complete this action on this device.';
|
||||
$body = 'Please log out or use a different device or browser to complete the invitation registration.';
|
||||
return view('errors.custom', compact('title', 'body'));
|
||||
}
|
||||
|
||||
$this->authPreflight($request, true, false);
|
||||
|
||||
$pc = ParentalControls::whereRaw('verify_code = BINARY ?', $code)->whereNull('email_verified_at')->findOrFail($id);
|
||||
|
|
10
resources/views/errors/custom.blade.php
Normal file
10
resources/views/errors/custom.blade.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="error-page py-5 my-5 text-center">
|
||||
<h3 class="font-weight-bold">{!! $title ?? config('instance.page.404.header')!!}</h3>
|
||||
<p class="lead">{!! $body ?? config('instance.page.404.body')!!}</p>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
Loading…
Reference in a new issue