git add .
git commit "add user authentication"
This commit is contained in:
@@ -3,9 +3,35 @@
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\LoginPostRequest;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
//
|
||||
public function index()
|
||||
{
|
||||
$withoutHeader = true;
|
||||
$withoutFooter = true;
|
||||
$withoutHero = true;
|
||||
|
||||
return view('auth.login',compact('withoutHeader','withoutHero','withoutFooter'));
|
||||
}
|
||||
|
||||
public function post(LoginPostRequest $request)
|
||||
{
|
||||
$user = $request->validated();
|
||||
|
||||
if (!Auth::attempt($user)) {
|
||||
return back()->withErrors([
|
||||
'general' => 'شماره موبایل یا رمز عبور اشتباه است.',
|
||||
])->withInput();
|
||||
}
|
||||
|
||||
$request->session()->regenerate();
|
||||
|
||||
return redirect()->route('users.dashboard');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user