vision vision - 1 month ago 5
PHP Question

Laravel incorrect email issue in Login

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>

Answer

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 +.