Файловый менеджер - Редактировать - /home/clickysoft/public_html/travel-guru.clickysoft.net/app/Repositories/Front/HomepageRepository.php
Назад
<?php namespace App\Repositories\Front; use App\Interfaces\Front\HomepageRepositoryInterface; use App\Models\User; use App\Notifications\UserResetPassword; use App\Notifications\VerifyEmailNotification; use Carbon\Carbon; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Str; use App\Jobs\SendForgotPasswordEmail; class HomepageRepository implements HomepageRepositoryInterface { public function loginAttempt($req) { $user = User::where('email', $req->email)->first(); if (!$this->isVerified($user)) return redirect()->back()->withInput()->with('error_msg', 'Please verify your account first.'); if (!$this->isActive($user)) return redirect()->back()->withInput()->with('error_msg', 'Your account is currently inactive, Please contact your admin.'); $rememberMe = !empty($req->remember_me); if (Auth::attempt(['email' => $req->email, 'password' => $req->password], $rememberMe)) { return redirect()->intended(); } else { return redirect()->back()->withInput()->with('error_msg', 'Invalid credentials.'); } } public function signUpAttempt($req) { $user = User::create([ 'full_name' => $req->name, 'email' => $req->email, 'password' => $req->password, 'is_verified' => true, 'is_active' => true, ]); Auth::loginUsingId($user->id); return redirect()->route('lunch.program'); } public function submitForgotPasswordReq($req) { $user = User::where('email', $req->email)->first(); $user->update([ 'verification_code' => Str::random(5) . Carbon::now()->timestamp . Str::random(5), 'is_verified' => 1, ]); $data = [ 'user' => $user, 'route' => 'reset.password' ]; SendForgotPasswordEmail::dispatch($user, $data); return redirect()->back()->with('success_msg', 'Please check your email, We have sent you reset password link.'); } public function resetPasswordReq($token, $req) { $user = $this->checkResetToken($token); if (!empty($user)) { $user->update([ 'verification_code' => null, 'password' => $req->password ]); return redirect()->route('login')->with('success_msg', 'Your password successfully reset.'); } else { abort(404); } } public function checkResetToken($token) { return User::where('verification_code', $token)->first(); } public function verifyUserAttempt($token) { $user = $this->checkResetToken($token); if (!empty($user)) { $user->update([ 'is_verified' => true, 'verification_code' => null, ]); return redirect()->route('login')->with('success_msg', 'Email verified successfully.'); } else { abort(404); } } public function logout() { Auth::logout(); return redirect()->route('login'); } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка