rubenochoa
1 week ago
250
8
Laravel

Issue about an error

Posted 1 week ago by rubenochoa

Hi. Something wrong happens. I get no error while i am trying just to submit sign in.

At usercontroller

 if (Auth::attempt(['email' => $request->input('email'), 'password' => $request->input('password')])){
            $user = User::where('email', '=', Input::get('email'))->first();
                if ($user === null) {
                    $request->session()->flash('usernotexist', 'User does not exist!');
                    return back();
                }
               else if (User::where('email', '=', Input::get('email'))->exists()) {
                    $request->session()->flash('userexist', 'User exist');
                    return back();
                }
             $remember_me = $request->has('remember_me') ? true : false; 
            if(Session::has('oldUrl')){
                $oldUrl = Session::get('oldUrl');
                Session::forget('oldUrl');
                return redirect()->to(Session::get('oldUrl'));
            }
            return redirect()->route('product.index');
        }
        return redirect()->back();

signin.blade.php


  <div class="form">
    <form action="">
      <h1>Sign in</h1>
      @if(count($errors) > 0)
    <div class="alert alert-danger">
        @foreach ($errors->all() as $error)
        <p>{{ $error }}</p>
        @endforeach
    </div>
    @endif
    @if(session('success'))
    <div class="alert alert-success">
        {{ session('success')}}
    </div>
    @endif
    @if(session('error'))
    <div class="alert alert-danger">
        {{ session('error')}}
    </div>
    @endif
    @if(session('userdelete'))
    <div class="alert alert-success">
        {{ session('userdelete')}}
    </div>
    @endif    
         @if (Session::has('usernoexist'))
            <div class="alert alert-danger  text-center">
               <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
                <p>{{ Session::get('no_user') }}</p>
               </div>
               @endif 
    <form action="{{ route('user.signin') }}" method="post">
      <input type="email" name="" id="email" placeholder="Enter email"><br>
      <input type="password" name="" id="password" placeholder="Enter password"><br>
      <input type="checkbox" onclick="confirmfunction()">Show Password
            <script>
                function confirmfunction() {
                    var x = document.getElementById("password");
                    if (x.type === "password") {
                      x.type = "text";
                    } else {
                      x.type = "password";
                    }
                  }
            </script>
      <input type="submit" value="Sign In" value="Sign in" class="signin"> <br>
      {{ csrf_field() }}<br><br>        
          <label for="remember_me">
              <input type="checkbox" name="remember_me" id="remember_me" value="1">Remember Me
          </label>     
    </form> 
      <p><a href="{{ route('password.request')}}">Forget password?</a></p><hr>
      <p class="signup">Do not have an account? <a href="{{ route('user.signup') }}">Sign up instead!</p>
  </div>
</body>
</html>

Please sign in or create an account to participate in this conversation.