2 回答

TA贡献1966条经验 获得超4个赞
您收到错误邮件的原因是必需的,因为您发送的是电子邮件而不是邮件。只是mail改成email
$this->validate($request, [
'email' => 'required|email',
'mdp'=> 'required'
]);
或将输入更改name attribute为mail
<input name="mail"/>
重写你的功能
use Illuminate\Support\Facades\Hash;
....
public function welcome(Request $request)
{
$request->validate([
'email' => 'required|email',
'mdp' => 'required',
]);
// since email is unique. no need to grab all data
$patient = patient::where('Login', $request->input('email'))->first();
// if patient exists
if ($patient) {
// check hashed password
// assuming $patient->Password hashed
if (Hash::check($request->input('mdp'), $patient->Password)) {
$request->session()->put('log_in', true);
return redirect('index', compact('patient'));
}
}
return back()->withErrors([
'message' => 'Emails or password not correct!',
]);
}

TA贡献1804条经验 获得超7个赞
你的 HTML 是<input type="text" class="form-control" name="email" />
输入的名称是“电子邮件”,在你正在搜索“邮件”的 php 中
'mail' => 'required|email',
它应该是:
<input type="text" class="form-control" name="mail" />
没有找到匹配的内容?试试慕课网站内搜索吧
- 2 回答
- 0 关注
- 128 浏览
添加回答
举报