feat: implement intern authentication and secure document dashboard for internship applications
This commit is contained in:
@@ -74,4 +74,63 @@ class CareerController extends Controller
|
||||
|
||||
return redirect()->back()->with('success', __('career.success_message'));
|
||||
}
|
||||
|
||||
public function internLoginForm()
|
||||
{
|
||||
if (session()->has('intern_id')) {
|
||||
return redirect()->route('intern.dashboard');
|
||||
}
|
||||
return view('front.career.intern_login', [
|
||||
'meta' => [
|
||||
'title' => 'Stajyer Girişi',
|
||||
'description' => 'İmzalı staj belgelerinize erişmek için lütfen giriş yapın.',
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
public function internLogin(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'username' => 'required|string',
|
||||
'password' => 'required|string',
|
||||
]);
|
||||
|
||||
$intern = CareerApplication::where('username', $request->username)
|
||||
->where('type', 'internship')
|
||||
->first();
|
||||
|
||||
if (!$intern || !\Illuminate\Support\Facades\Hash::check($request->password, $intern->password)) {
|
||||
return redirect()->back()
|
||||
->withInput($request->only('username'))
|
||||
->withErrors([
|
||||
'username' => 'Girdiğiniz kullanıcı adı veya şifre hatalı.',
|
||||
]);
|
||||
}
|
||||
|
||||
session(['intern_id' => $intern->id]);
|
||||
|
||||
return redirect()->route('intern.dashboard')->with('success', 'Başarıyla giriş yapıldı.');
|
||||
}
|
||||
|
||||
public function internDashboard()
|
||||
{
|
||||
if (!session()->has('intern_id')) {
|
||||
return redirect()->route('intern.login')->with('error', 'Lütfen giriş yapın.');
|
||||
}
|
||||
|
||||
$intern = CareerApplication::findOrFail(session('intern_id'));
|
||||
return view('front.career.intern_dashboard', [
|
||||
'intern' => $intern,
|
||||
'meta' => [
|
||||
'title' => 'Stajyer Paneli',
|
||||
'description' => 'Belgelerinizi buradan indirebilirsiniz.',
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
public function internLogout()
|
||||
{
|
||||
session()->forget('intern_id');
|
||||
return redirect()->route('intern.login')->with('success', 'Başarıyla çıkış yapıldı.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user