Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of github.com:microweber/microweber into dev
- Loading branch information
Showing
10 changed files
with
187 additions
and
84 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
src/MicroweberPackages/User/Http/Controllers/UserLogoutController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
namespace MicroweberPackages\User\Http\Controllers; | ||
|
||
use App\Http\Resources\User\UserResource; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Routing\Controller; | ||
use Illuminate\Support\Facades\Auth; | ||
use MicroweberPackages\App\Http\Middleware\SameSiteRefererMiddleware; | ||
|
||
class UserLogoutController extends Controller | ||
{ | ||
public $middleware = [ | ||
[ | ||
'middleware' => 'xss', | ||
'options' => [] | ||
] | ||
]; | ||
|
||
public function __construct() | ||
{ | ||
event_trigger('mw.init'); | ||
} | ||
|
||
/** | ||
* Display a listing of Role. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function index(Request $request) | ||
{ | ||
$ref = $request->headers->get('referer'); | ||
|
||
$sameSite = app()->make(SameSiteRefererMiddleware::class); | ||
$isSameSite = $sameSite->isSameSite($ref); | ||
|
||
if ($isSameSite) { | ||
return logout($request->all()); | ||
} | ||
|
||
return view('user::logout.index'); | ||
} | ||
|
||
public function submit(Request $request) | ||
{ | ||
Auth::logout(); | ||
|
||
$url = site_url(); | ||
$redirect = $request->post('redirect_to', false); | ||
if ($redirect) { | ||
$url = $redirect; | ||
} | ||
|
||
return app()->url_manager->redirect($url); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 30 additions & 72 deletions
102
src/MicroweberPackages/User/resources/views/auth/forgot-password.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,57 @@ | ||
<!DOCTYPE html> | ||
<html <?php print lang_attributes(); ?>> | ||
<head> | ||
<title><?php _e('Resend'); ?></title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="robots" content="noindex"> | ||
<?php get_favicon_tag(); ?> | ||
@extends('user::layout') | ||
|
||
<link type="text/css" rel="stylesheet" media="all" href="<?php print mw_includes_url(); ?>default.css"/> | ||
<link type="text/css" rel="stylesheet" media="all" | ||
href="<?php print(mw()->template->get_admin_system_ui_css_url()); ?>"/> | ||
@section('content') | ||
<form class="form-horizontal" role="form" method="POST" | ||
action="{{ route('password.email') }}"> | ||
<h2>Password Reset</h2> | ||
@csrf | ||
|
||
<script src="<?php print(mw()->template->get_apijs_combined_url()); ?>"></script> | ||
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}"> | ||
|
||
</head> | ||
|
||
<body> | ||
<label class="control-label">Enter your email</label> | ||
|
||
<main class="w-100 h-100vh "> | ||
<div class="row my-5 d-flex align-items-center "> | ||
<div class="col-12 col-sm-9 col-md-7 col-lg-5 col-xl-4 mx-auto"> | ||
<input type="text" class="form-control" id="email" name="email" | ||
placeholder="Email"/> | ||
|
||
|
||
<div class="card"> | ||
<div class="card-body py-4"> | ||
@if ($errors->has('email')) | ||
|
||
<div class="help-block text-danger"><strong>{{ $errors->first('email') }}</strong></div> | ||
|
||
@if (session('status')) | ||
<div class="alert alert-success"> | ||
{{ session('status') }} | ||
</div> | ||
@endif | ||
@endif | ||
|
||
<form class="form-horizontal" role="form" method="POST" | ||
action="{{ route('password.email') }}"> | ||
<h2>Password Reset</h2> | ||
@csrf | ||
|
||
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}"> | ||
@if (get_option('captcha_disabled', 'users') !== 'y') | ||
|
||
|
||
<label class="control-label">Enter your email</label> | ||
@if ($errors->has('captcha')) | ||
|
||
<input type="text" class="form-control" id="email" name="email" | ||
placeholder="Email"/> | ||
|
||
|
||
@if ($errors->has('email')) | ||
|
||
<div class="help-block text-danger"><strong>{{ $errors->first('email') }}</strong></div> | ||
|
||
@endif | ||
|
||
|
||
@if (get_option('captcha_disabled', 'users') !== 'y') | ||
|
||
|
||
@if ($errors->has('captcha')) | ||
|
||
<div class="help-block text-danger"><strong>{{ $errors->first('captcha') }}</strong> | ||
</div> | ||
|
||
@endif | ||
|
||
<module type="captcha"/> | ||
|
||
@endif | ||
|
||
|
||
</div> | ||
<div class="help-block text-danger"><strong>{{ $errors->first('captcha') }}</strong> | ||
</div> | ||
|
||
<div class="d-flex justify-content-between align-items-center"> | ||
@endif | ||
|
||
<a class="btn btn-link" class="reset_pass" href="{{route('login')}}">Login</a> | ||
<module type="captcha"/> | ||
|
||
<button type="submit" class="btn btn-primary submit">Send Password | ||
Reset Link | ||
</button> | ||
@endif | ||
|
||
|
||
</div> | ||
</div> | ||
|
||
<div class="clearfix"></div> | ||
<div class="d-flex justify-content-between align-items-center"> | ||
|
||
<a class="btn btn-link" class="reset_pass" href="{{route('login')}}">Login</a> | ||
|
||
</form> | ||
<button type="submit" class="btn btn-primary submit">Send Password | ||
Reset Link | ||
</button> | ||
|
||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
<div class="clearfix"></div> | ||
|
||
|
||
</main> | ||
</body> | ||
</html> | ||
</form> | ||
@endsection |
48 changes: 48 additions & 0 deletions
48
src/MicroweberPackages/User/resources/views/layout.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!DOCTYPE html> | ||
<html <?php print lang_attributes(); ?>> | ||
<head> | ||
<title><?php _e('Resend'); ?></title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="robots" content="noindex"> | ||
<?php get_favicon_tag(); ?> | ||
|
||
<link type="text/css" rel="stylesheet" media="all" href="<?php print mw_includes_url(); ?>default.css"/> | ||
<link type="text/css" rel="stylesheet" media="all" | ||
href="<?php print(mw()->template->get_admin_system_ui_css_url()); ?>"/> | ||
|
||
<script src="<?php print(mw()->template->get_apijs_combined_url()); ?>"></script> | ||
|
||
</head> | ||
|
||
<body> | ||
|
||
<main class="w-100 h-100vh "> | ||
<div class="row my-5 d-flex align-items-center "> | ||
<div class="col-12 col-sm-9 col-md-7 col-lg-5 col-xl-4 mx-auto"> | ||
|
||
<div class="card"> | ||
<div class="card-body py-4"> | ||
|
||
@if (session('status')) | ||
<div class="alert alert-success"> | ||
{{ session('status') }} | ||
</div> | ||
@endif | ||
|
||
@hasSection('content') | ||
@yield('content') | ||
@endif | ||
|
||
|
||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
|
||
</main> | ||
</body> | ||
</html> |
25 changes: 25 additions & 0 deletions
25
src/MicroweberPackages/User/resources/views/logout/index.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
@extends('user::layout') | ||
|
||
@section('content') | ||
|
||
|
||
<center> | ||
<h3> {{ _e('Please confirm you want to logout') }} </h3> | ||
|
||
<form class="form-horizontal" role="form" method="POST" action="{{ route('logout.submit') }}"> | ||
|
||
@csrf | ||
<br /> | ||
|
||
@if(isset($_GET['redirect_to'])) | ||
<input type="hidden" name="redirect_to" value="{{$_GET['redirect_to']}}"> | ||
@endif | ||
|
||
<button type="submit" class="btn btn-primary submit"> | ||
{{ _e('Confirm') }} | ||
</button> | ||
|
||
</form> | ||
</center> | ||
|
||
@endsection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters