【问题标题】:Laravel - Can't get input errors when using google recaptchaLaravel - 使用谷歌recaptcha时无法输入错误
【发布时间】:2019-01-18 05:30:55
【问题描述】:

我在我的登录表单中使用 google recaptcha。我在登录模板中粘贴了脚本标签和sn-p,并将'g-recaptcha-response' => 'required|captcha', 添加到AuthenticatesUsers.phpvalidateLogin 方法的数组中。当我提交表格时,我只收到recaptcha 错误,而不是电子邮件或密码输入!当我删除 'g-recaptcha-response' => 'required|captcha', 时会出错!

【问题讨论】:

标签: laravel recaptcha


【解决方案1】:

也许您可以尝试自己设置一个新的验证器(不确定它是否可行,这是一个想法)。

这是此文档部分的链接:https://laravel.com/docs/5.6/validation#manually-creating-validators

以及附加到操作的控制器文件中的示例:

protected function validator(array $data)
{
    return Validator::make($data, [
        'name' => 'required|string|max:255',
        'email' => 'required|string|email|max:255|unique:users',
        'password' => 'required|string|min:6|confirmed',
        'g-recaptcha-response' => 'required|captcha',
    ]);
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-17
    • 1970-01-01
    • 2021-05-22
    • 1970-01-01
    • 2023-02-23
    • 1970-01-01
    • 2020-09-17
    • 2020-12-22
    相关资源
    最近更新 更多