Route cosmetic layout updates, and standardise on using /home to redirect back to the homescreen, and standardise usage of redirect()
This commit is contained in:
parent
256e4c6260
commit
8d72c1ceb5
@ -27,7 +27,7 @@ class SocialLoginController extends Controller
|
||||
$openiduser = Socialite::with($provider)->user();
|
||||
|
||||
if (! $openiduser)
|
||||
return redirect('/home')
|
||||
return redirect('home')
|
||||
->with('error','No user details obtained.');
|
||||
|
||||
$oo = ProviderOauth::firstOrCreate(['name'=>$provider,'active'=>TRUE]);
|
||||
@ -43,7 +43,7 @@ class SocialLoginController extends Controller
|
||||
$user = User::where('email',$openiduser->email)->first();
|
||||
|
||||
if ((! $user) || (! $user->active))
|
||||
return redirect('/login')
|
||||
return redirect('login')
|
||||
->with('error','Invalid account, or account inactive, please contact an admin.');
|
||||
|
||||
return $this->link($provider,$aoo,$user);
|
||||
@ -54,7 +54,7 @@ class SocialLoginController extends Controller
|
||||
|
||||
// If there are too many users, then we have a problem
|
||||
} elseif ($aoo->count() > 1) {
|
||||
return redirect('/login')
|
||||
return redirect('login')
|
||||
->with('error','Seems you have multiple oauth IDs, please contact an admin.');
|
||||
|
||||
// User is using OAUTH for the first time.
|
||||
@ -73,11 +73,11 @@ class SocialLoginController extends Controller
|
||||
|
||||
// If there are too many users, then we have a problem
|
||||
} elseif ($uo->count() > 1) {
|
||||
return redirect('/login')
|
||||
return redirect('login')
|
||||
->with('error','Seems you have multiple accounts, please contact an admin.');
|
||||
|
||||
} else {
|
||||
return redirect('/login')
|
||||
return redirect('login')
|
||||
->with('error','Seems you dont have an account with that email, please contact an admin.');
|
||||
}
|
||||
}
|
||||
@ -91,7 +91,7 @@ class SocialLoginController extends Controller
|
||||
$openiduser = Socialite::with($provider)->user();
|
||||
|
||||
if (! $openiduser)
|
||||
return redirect('/home')
|
||||
return redirect('home')
|
||||
->with('error','No user details obtained.');
|
||||
|
||||
$po = ProviderOauth::where('name',$provider)->singleOrFail();
|
||||
@ -137,12 +137,12 @@ class SocialLoginController extends Controller
|
||||
|
||||
// Check our email matches
|
||||
if (Arr::get($aoo->oauth_data,'email','invalid') !== $request->post('email'))
|
||||
return redirect('/login')
|
||||
return redirect('login')
|
||||
->with('error','Account details didnt match to make link.');
|
||||
|
||||
// Check our token matches
|
||||
if ($aoo->link_token !== $request->post('token'))
|
||||
return redirect('/login')
|
||||
return redirect('login')
|
||||
->with('error','Token details didnt match to make link.');
|
||||
|
||||
// Load our email.
|
||||
|
@ -34,8 +34,7 @@ class CheckoutController extends Controller
|
||||
}
|
||||
|
||||
return $o->wasRecentlyCreated
|
||||
? redirect()
|
||||
->to('a/checkout/'.$o->id)
|
||||
? redirect('a/checkout/'.$o->id)
|
||||
->with('success','Checkout added')
|
||||
: redirect()
|
||||
->back()
|
||||
|
@ -50,7 +50,7 @@ class HomeController extends Controller
|
||||
} catch (ExpiredInviteCode $e) {
|
||||
Log::alert(sprintf('User is using an expired token for invoice [%s] using [%s]',$o->id,$code));
|
||||
|
||||
return redirect()->to('/login');
|
||||
return redirect('login');
|
||||
|
||||
} catch (DoormanException $e) {
|
||||
Log::alert(sprintf('An attempt to read invoice id [%s] using [%s]',$o->id,$code));
|
||||
@ -72,6 +72,6 @@ class HomeController extends Controller
|
||||
*/
|
||||
public function service_progress(Service $o,string $status)
|
||||
{
|
||||
return redirect()->to($o->action($status) ?: url('u/service',$o->id));
|
||||
return redirect($o->action($status) ?: url('u/service',$o->id));
|
||||
}
|
||||
}
|
@ -63,8 +63,7 @@ class PaymentController extends Controller
|
||||
}
|
||||
|
||||
return $o->wasRecentlyCreated
|
||||
? redirect()
|
||||
->to('r/payment/'.$o->id)
|
||||
? redirect('r/payment/'.$o->id)
|
||||
->with('success','Payment added')
|
||||
: redirect()
|
||||
->back()
|
||||
|
@ -34,8 +34,7 @@ class PaypalController extends Controller
|
||||
|
||||
public function cancel()
|
||||
{
|
||||
return redirect()
|
||||
->to(self::cart_url);
|
||||
return redirect(self::cart_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -52,8 +51,7 @@ class PaypalController extends Controller
|
||||
$cart = request()->session()->get('invoice.cart');
|
||||
|
||||
if (! $cart)
|
||||
return redirect()
|
||||
->to('u/home');
|
||||
return redirect('home');
|
||||
|
||||
$invoices = Invoice::find($cart);
|
||||
|
||||
@ -113,15 +111,13 @@ class PaypalController extends Controller
|
||||
} catch (HttpException $e) {
|
||||
Log::error('Paypal Exception',['request'=>$paypal,'response'=>$e->getMessage()]);
|
||||
|
||||
return redirect()
|
||||
->to(self::cart_url)
|
||||
return redirect(self::cart_url)
|
||||
->withErrors('Paypal Exception: '.$e->getCode());
|
||||
|
||||
} catch (\HttpException $e) {
|
||||
Log::error('HTTP Exception',['request'=>$this->client,'response'=>$e->getMessage()]);
|
||||
|
||||
return redirect()
|
||||
->to(self::cart_url)
|
||||
return redirect(self::cart_url)
|
||||
->withErrors('HTTP Exception: '.$e->getCode());
|
||||
}
|
||||
|
||||
@ -138,8 +134,7 @@ class PaypalController extends Controller
|
||||
return redirect()
|
||||
->away($redirect_url);
|
||||
|
||||
return redirect()
|
||||
->to(self::cart_url)
|
||||
return redirect(self::cart_url)
|
||||
->withErrors('An error occurred with Paypal?');
|
||||
}
|
||||
|
||||
@ -192,23 +187,20 @@ class PaypalController extends Controller
|
||||
->away($redirect_url);
|
||||
}
|
||||
|
||||
return redirect()
|
||||
->to(self::cart_url)
|
||||
return redirect(self::cart_url)
|
||||
->withErrors('An error occurred with Paypal?');
|
||||
|
||||
} catch (\HttpException $e) {
|
||||
Log::error('HTTP Exception',['request'=>$paypal,'response'=>$e->getMessage()]);
|
||||
|
||||
return redirect()
|
||||
->to(self::cart_url)
|
||||
return redirect(self::cart_url)
|
||||
->withErrors('HTTP Exception: '.$e->getCode());
|
||||
}
|
||||
|
||||
if ((! $response) || (! $response->result->purchase_units)) {
|
||||
Log::error('Paypal Capture: No Purchase Units?');
|
||||
|
||||
return redirect()
|
||||
->to(self::cart_url)
|
||||
return redirect(self::cart_url)
|
||||
->withErrors('Paypal Exception: NPU');
|
||||
}
|
||||
|
||||
@ -267,8 +259,7 @@ class PaypalController extends Controller
|
||||
|
||||
Log::info('Paypal Payment Recorded',['po'=>$po->id]);
|
||||
|
||||
return redirect()
|
||||
->to('u/home')
|
||||
return redirect('home')
|
||||
->with('success','Payment recorded thank you.');
|
||||
}
|
||||
}
|
@ -113,7 +113,7 @@ class ServiceController extends Controller
|
||||
$np->pivot->effective_at = Carbon::now();
|
||||
$np->pivot->save();
|
||||
|
||||
return redirect()->to(url('u/service',[$o->id]));
|
||||
return redirect(url('u/service',[$o->id]));
|
||||
}
|
||||
|
||||
return view('theme.backend.adminlte.service.change_pending')
|
||||
@ -191,7 +191,7 @@ class ServiceController extends Controller
|
||||
|
||||
// An Error Condition
|
||||
if (is_null($result))
|
||||
return redirect()->to('u/service/'.$o->id);
|
||||
return redirect('u/service/'.$o->id);
|
||||
|
||||
elseif ($result instanceof RedirectResponse)
|
||||
return $result;
|
||||
@ -213,7 +213,7 @@ class ServiceController extends Controller
|
||||
$stage = ''; // @todo this is temporary, we havent written the code to automatically jump to the next stage if wecan
|
||||
}
|
||||
|
||||
return redirect()->to('u/service/'.$o->id);
|
||||
return redirect('u/service/'.$o->id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,7 +30,9 @@ class SupplierController extends Controller
|
||||
$o->save();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return redirect()->back()->withErrors($e->getMessage())->withInput();
|
||||
return redirect()
|
||||
->back()
|
||||
->withErrors($e->getMessage())->withInput();
|
||||
}
|
||||
|
||||
$o->load(['detail']);
|
||||
|
@ -19,7 +19,7 @@
|
||||
$ao->load(['services:id,active,account_id']);
|
||||
@endphp
|
||||
<tr>
|
||||
<td><a href="{{ url('r/switch/start',$ao->user_id) }}"><i class="fas fa-external-link-alt"></i></a></td>
|
||||
<td><a href="{{ url('switch/start',$ao->user_id) }}"><i class="fas fa-external-link-alt"></i></a></td>
|
||||
<td><a href="{{ url('u/home',$ao->user_id) }}">{{ $ao->name }}</a></td>
|
||||
<td class="text-right">{{ $ao->services->where('active',TRUE)->count() }} <small>/{{ $ao->services->count() }}</small></td>
|
||||
</tr>
|
||||
|
@ -46,7 +46,7 @@
|
||||
|
||||
<div class="dropdown-divider"></div>
|
||||
@if($user->switched)
|
||||
<a href="{{ url('/admin/switch/stop') }}" class="dropdown-item">
|
||||
<a href="{{ url('switch/stop') }}" class="dropdown-item">
|
||||
<i class="fas fa-sign-out-alt mr-2"></i> {{ trans('adminlte_lang::message.switchoff') }}
|
||||
</a>
|
||||
@else
|
||||
|
@ -18,8 +18,7 @@ use App\Http\Controllers\{AdminController,
|
||||
SearchController,
|
||||
ServiceController,
|
||||
SupplierController,
|
||||
UserController,
|
||||
Wholesale\ReportController};
|
||||
UserController};
|
||||
use App\Models\Supplier;
|
||||
|
||||
/*
|
||||
@ -42,8 +41,8 @@ Auth::routes([
|
||||
'confirm' => false, // for additional password confirmations
|
||||
'verify' => false, // for email verification
|
||||
]);
|
||||
Route::get('logout',[LoginController::class,'logout'])
|
||||
->name('logout-get');
|
||||
// Auth::routes doesnt provide a get /logout path, so we'll specify it here
|
||||
Route::get('logout',[LoginController::class,'logout']);
|
||||
|
||||
// Frontend Routes (Non-Authed Users)
|
||||
Route::view('/','theme.frontend.metronic.welcome.home');
|
||||
@ -54,21 +53,35 @@ Route::redirect('passkey/loggedin','/u/home');
|
||||
|
||||
Route::get('search',[SearchController::class,'search']);
|
||||
|
||||
Route::get('pay/paypal/authorise',[PaypalController::class,'authorise']);
|
||||
Route::get('pay/paypal/cancel',[PaypalController::class,'cancel']);
|
||||
Route::get('pay/paypal/capture',[PaypalController::class,'capture']);
|
||||
// Paypal paths
|
||||
Route::controller(PaypalController::class)
|
||||
->prefix('pay/paypal')
|
||||
->group(function() {
|
||||
Route::get('authorise','authorise');
|
||||
Route::get('cancel','cancel');
|
||||
Route::get('capture','capture');
|
||||
});
|
||||
|
||||
// Account linking to OPENID host
|
||||
Route::get('auth/{socialProvider}',[SocialLoginController::class,'redirectToProvider']);
|
||||
Route::get('auth/{socialProvider}/callback',[SocialLoginController::class,'handleProviderCallback']);
|
||||
Route::get('auth/{socialProvider}/token',[SocialLoginController::class,'handleBearerTokenCallback']);
|
||||
Route::get('auth/{socialProvider}/link',[SocialLoginController::class,'link']);
|
||||
Route::post('auth/{socialProvider}/linkcomplete',[SocialLoginController::class,'linkcomplete']);
|
||||
Route::controller(PaypalController::class)
|
||||
->prefix('auth')
|
||||
->group(function() {
|
||||
Route::get('{socialProvider}','redirectToProvider');
|
||||
Route::get('{socialProvider}/callback','handleProviderCallback');
|
||||
Route::get('{socialProvider}/token','handleBearerTokenCallback');
|
||||
Route::get('{socialProvider}/link','link');
|
||||
Route::post('{socialProvider}/linkcomplete','linkcomplete');
|
||||
});
|
||||
|
||||
// Return from user switch
|
||||
Route::get('admin/switch/stop',[SwitchUserController::class,'switch_stop'])
|
||||
// User Switch
|
||||
Route::controller(SwitchUserController::class)
|
||||
->prefix('switch')
|
||||
->middleware('auth')
|
||||
->name('switch.stop');
|
||||
->group(function() {
|
||||
Route::get('stop','switch_stop');
|
||||
Route::get('start/{user}','switch_start')
|
||||
->middleware(['role:reseller','can:assume,user']);
|
||||
});
|
||||
|
||||
// Our Admin Routes - for wholesalers
|
||||
Route::group(['middleware'=>['auth','role:wholesaler'],'prefix'=>'a'],function() {
|
||||
@ -137,11 +150,6 @@ Route::group(['middleware'=>['auth','role:wholesaler'],'prefix'=>'a'],function()
|
||||
|
||||
// Our Reseller Routes
|
||||
Route::group(['middleware'=>['auth','role:reseller'],'prefix'=>'r'],function() {
|
||||
// Enable user switch
|
||||
Route::get('switch/start/{user}',[SwitchUserController::class,'switch_start'])
|
||||
->middleware('can:assume,user')
|
||||
->name('switch.start');
|
||||
|
||||
// Reseller Reports
|
||||
Route::group(['prefix'=>'report'],function() {
|
||||
Route::view('charge/pending','theme.backend.adminlte.charge.pending');
|
||||
|
Loading…
x
Reference in New Issue
Block a user