fix bug login & delete
This commit is contained in:
@@ -49,16 +49,16 @@ class LoginController extends Controller
|
|||||||
// Check the current guard and redirect accordingly
|
// Check the current guard and redirect accordingly
|
||||||
if (Auth::guard('admin')->check()) {
|
if (Auth::guard('admin')->check()) {
|
||||||
// Redirect admins to their dashboard
|
// Redirect admins to their dashboard
|
||||||
return route('admin.dashboard');
|
return '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Auth::guard('web')->check()) {
|
if (Auth::guard('web')->check()) {
|
||||||
// Redirect regular users to their home or default page
|
// Redirect regular users to their home or default page
|
||||||
return route('trx_order_elevation.index');
|
return '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default redirection if no condition matches
|
// Default redirection if no condition matches
|
||||||
return '/admin/login';
|
return '/login';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -104,11 +104,14 @@ class LoginController extends Controller
|
|||||||
|
|
||||||
AuditTrailHelper::AuthAttempt('Login', 'User (' . $request->email . ') Logged in to the System');
|
AuditTrailHelper::AuthAttempt('Login', 'User (' . $request->email . ') Logged in to the System');
|
||||||
return redirect($redirectTo);
|
return redirect($redirectTo);
|
||||||
}
|
} else {
|
||||||
|
// Log activity
|
||||||
|
AuditTrailHelper::AuthAttempt('Login', 'Failed login attempt for User (' . $request->email . ')');
|
||||||
|
|
||||||
// Login failed
|
// Login failed
|
||||||
session()->flash('error', 'Invalid email or password.');
|
session()->flash('error', 'Invalid email or password.');
|
||||||
return back();
|
return back();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -596,6 +596,7 @@ class FormUpCountryController extends Controller
|
|||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['forms.country.delete']);
|
$this->checkAuthorization(auth()->user(), ['forms.country.delete']);
|
||||||
|
$role = auth()->user()->getRoleNames()[0];
|
||||||
|
|
||||||
$form = FormUpCountry::findOrfail($id);
|
$form = FormUpCountry::findOrfail($id);
|
||||||
if($form->status != 'On Progress' && $role == 'Medical Representatif') {
|
if($form->status != 'On Progress' && $role == 'Medical Representatif') {
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>{{ config('app.app_name') }} - Login</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
<link rel="icon" type="image/x-icon" href="{{ asset('templates/dist/img/logo.ico') }}">
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="{{ asset('templates/dist/img/logo.ico') }}">
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fiqhpratama/upsense-cdn@main/adminlte-blue/login/css/style.css">
|
||||||
|
<script src="https://cdn.jsdelivr.net/gh/fiqhpratama/upsense-cdn@main/adminlte-blue/plugins/sweetalert2/sweetalert2.all.min.js"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<section class="ftco-section">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-12 col-lg-10">
|
||||||
|
<div class="wrap d-md-flex">
|
||||||
|
<div class="img"
|
||||||
|
style="background-image: url({{ asset('templates/login') }}/images/bg-1.png);">
|
||||||
|
</div>
|
||||||
|
<div class="login-wrap p-4 p-md-5">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="w-100">
|
||||||
|
<div class="text-center">
|
||||||
|
<img src="{{ asset('templates/dist/img/small-logo.png') }}" alt="App Logo Text" width="80" height="80" class="brand-text brand-image">
|
||||||
|
</div>
|
||||||
|
<h3 class="mb-4 text-center">Login into {{ config('app.app_name') }}</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<form method="POST" class="signin-form" action="{{ route('admin.login.submit') }}">
|
||||||
|
@csrf
|
||||||
|
@include('backend.layouts.partials.messages')
|
||||||
|
|
||||||
|
<div class="form-group mb-3">
|
||||||
|
<label class="label" for="name">Username</label>
|
||||||
|
<input type="text" class="form-control" id="email" name="email"
|
||||||
|
placeholder="Isikan Username anda" required>
|
||||||
|
<i class="ti-email"></i>
|
||||||
|
<div class="text-danger"></div>
|
||||||
|
@error('email')
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
<strong>{{ $message }}</strong>
|
||||||
|
</span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
<div class="form-group mb-3">
|
||||||
|
<label class="label" for="password">Password</label>
|
||||||
|
<input type="password" id="password" placeholder="Isikan Password anda"
|
||||||
|
class="form-control" name="password" required>
|
||||||
|
<i class="ti-lock"></i>
|
||||||
|
<div class="text-danger"></div>
|
||||||
|
@error('password')
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
<strong>{{ $message }}</strong>
|
||||||
|
</span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<button id="form_submit" type="submit"
|
||||||
|
class="form-control btn btn-primary rounded submit px-3">Masuk</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/gh/fiqhpratama/upsense-cdn@main/adminlte-blue/login/js/jquery.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/gh/fiqhpratama/upsense-cdn@main/adminlte-blue/login/js/popper.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/gh/fiqhpratama/upsense-cdn@main/adminlte-blue/login/js/bootstrap.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/gh/fiqhpratama/upsense-cdn@main/adminlte-blue/login/js/main.js"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user