duande1146 2016-10-17 03:02
浏览 34
已采纳

Laravel在登录时出现错误的电子邮件问题

I have login registration module which is built using auth.Every think is working fine.Suppose i have following email id vision+myvison@gmail.com in database user table but when i try to login its giving incorrect email.I am pretty sure that its giving error because of plus in email id.In my project its necessary to accept plus because of alias.Can any one help me how to fix this issue.I am using raw query

$userDetails = DB::table('users')->select('id', 'firstname', 'lastname', 'email', 'password', 'role', 'confirm', 'status')->where('email', $email)->first();

Updated

public function login(Request $request) {    
        $validator = Validator::make($request->all(), [
        'password' => 'required',
        'email' => 'required',
        ]);
        if ($validator->fails()) { 
            echo "error";
        }
        $email = $request->input('email');
        $password = $request->input('password'); 
        \Log::info($email);

        $userDetails = DB::table('users')->select('id', 'firstname', 'lastname', 'email', 'password', 'role', 'confirm', 'status')->where('email', $email)->first();

        if (count($userDetails) != 0) {

Updated 2

 <form class="form-horizontal" role="form" method="POST" action="{{ url('/auth/login') }}">
                        <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
                        <h4 class="nomargin">Sign in</h4>

                        <input type="text" class="form-control uname" name="email" placeholder="email" autocomplete="off" value="{{ old('email') }}" />
                        <input type="password" class="form-control pword" name="password" placeholder="password" autocomplete="off" />
                        <a style="color:#17a08c" href="{{ url('/password/email') }}"><small>Forgot Password</small></a>
                        <button type="submit" class="btn btn-success btn-block text-capitalise">Sign in</button>
                    </form>
  • 写回答

2条回答 默认 最新

  • dongni8969 2016-10-17 04:50
    关注

    If you're submitting via get method then plus(+) is an issue in URL and replaced by white space. You need to encode parameters before passing, so that it won't remove +.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作