且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Laravel 5.4进行自定义登录密码检查

更新时间:2023-09-28 17:34:10

默认情况下,可能尝试使用如下所示的身份验证中间件:

Probably try using the Middleware of the authentication looking like this by default:

<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\Auth;

class RedirectIfAuthenticated
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @param  string|null  $guard
     * @return mixed
     */
    public function handle($request, Closure $next, $guard = null)
    {
        if (Auth::guard($guard)->check()) {
            return redirect('/home');
        }

        return $next($request);
    }
}

尝试检查用户是否已通过身份验证,然后如果未调用该函数,则该函数将使用您的密码并签入您的数据库.

Try to check if the user has been authenticated then if not call a function that will take your password and check in your database.