【发布时间】:2017-09-11 16:23:24
【问题描述】:
我正在开发 laravel 5.2 框架,我正在维护和保护我们的代码。现在我面临一个问题。假设有一个这样的登录表单:-
<form id="userLoginForm" method="post" action="{{ url('/login') }}">{{csrf_field()}}
<label>Email: </label>
<input type="text" name="email" autocomplete="off" placeholder="Email" class="input-style" />
<label>Password: </label>
<input type="password" name="password" autocomplete="off" placeholder="Password" class="input-style" />
<input type="submit" class="green-btn-style" value="LOGIN" />
现在假设我按下键盘上的删除按钮,现在令牌已从我们的表单中删除。现在当我提交表格时。它将向我显示令牌不匹配的预期。但我不想向黑客或用户显示该错误.. 我也实现了 isset 但没有工作。 我的登录代码:-
if(isset($data['email']) && isset($data['password']) && isset($data['_token']) && Auth::attempt(['email' => $data['email'],'password' => $data['password']])) {
//redirect to dashboard
}
谁能帮我解决这个问题。
【问题讨论】:
-
如果您将调试变量
.env设置为false,他们将看到“哎呀!出了点问题” -
它已经显示出了问题!
标签: php laravel laravel-5.2