mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge pull request #593 from openclassify/vedat
#1657 add authCheck Middleware
This commit is contained in:
commit
bf3735ece0
@ -1,5 +1,5 @@
|
||||
.ad-detail-tabs .nav-link.active {
|
||||
background-color: #FFC106 !important;
|
||||
background-color: #FFC106;
|
||||
border-color: #ffc107 #ffc107 #ffc107;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Visiosoft\ProfileModule\Http\Middleware;
|
||||
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class authCheck
|
||||
{
|
||||
|
||||
private $auth;
|
||||
private $request;
|
||||
|
||||
public function __construct(Guard $auth,Request $request)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Guard $auth
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if ($this->auth->check()) {
|
||||
return redirect($this->request->get('redirect', '/'));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,7 @@ use Visiosoft\ProfileModule\Adress\Contract\AdressRepositoryInterface;
|
||||
use Visiosoft\ProfileModule\Adress\AdressRepository;
|
||||
use Anomaly\Streams\Platform\Model\Profile\ProfileAdressEntryModel;
|
||||
use Visiosoft\ProfileModule\Adress\AdressModel;
|
||||
use Visiosoft\ProfileModule\Http\Middleware\authCheck;
|
||||
use Visiosoft\ProfileModule\Profile\Password\ForgotPassFormBuilder;
|
||||
use Visiosoft\ProfileModule\Profile\Password\PasswordFormBuilder;
|
||||
use Visiosoft\ProfileModule\Profile\Profile\ProfileFormBuilder;
|
||||
@ -105,6 +106,15 @@ class ProfileModuleServiceProvider extends AddonServiceProvider
|
||||
],
|
||||
'ajax/phone-validation' => 'Visiosoft\ProfileModule\Http\Controller\UserAuthenticator@phoneValidation',
|
||||
|
||||
'register' => [
|
||||
'middleware' => [
|
||||
authCheck::class
|
||||
],
|
||||
'ttl' => 0,
|
||||
'as' => 'anomaly.module.users::register',
|
||||
'uses' => 'Anomaly\UsersModule\Http\Controller\RegisterController@register',
|
||||
],
|
||||
|
||||
/* Login */
|
||||
'login-in' => 'Visiosoft\ProfileModule\Http\Controller\UserAuthenticator@attempt',
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user