39 lines
854 B
PHP
39 lines
854 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
class SessionsController extends Controller
|
|
{
|
|
public function create()
|
|
{
|
|
return view('login');
|
|
}
|
|
|
|
public function store()
|
|
{
|
|
if (auth()->attempt(request(['email', 'password'])) == false) {
|
|
return back()->withErrors([
|
|
'message' => 'Podany adres email lub hasło jest nieprawidłowe, proszę spróbować ponownie.'
|
|
]);
|
|
}
|
|
elseif(auth()->user()->statusID == 1)
|
|
{
|
|
auth()->logout();
|
|
return back()->withErrors([
|
|
'message' => 'Twoje konto zostało zawieszone.'
|
|
]);
|
|
}
|
|
|
|
return redirect()->to('/jednostka');
|
|
}
|
|
|
|
public function destroy()
|
|
{
|
|
auth()->logout();
|
|
|
|
return redirect()->to('/login');
|
|
}
|
|
}
|