This error is driving me nuts. I'm trying to create a retrieve password form and this error keeps getting thrown when I submit it. Token is definitely being provided, so I don't know what is wrong. This happens only on my local so far. It doesn't happen on production. And at the same time, not sure if it's related, I get
InvalidStateException in AbstractProvider.php line 191
when i try to login with socialite(google & fb). One tends to occur when the other occurs. If I get tokenMismatch from submitting the form and then try to login, I get this error.
Anyway here's the form. I really need help here
{!! Form::open(['method'=>'post', 'action'=>'PasswordRetrieveController@getUser','id'=>'retrieve-pw-form'])!!}
<div class='form-group'>
{!! form::label('email','Email Address')!!}
{!!Form::text('email','',['class'=>'form-control','type'=>'email','required'=>'required'])!!}
</div>
{!!Form::submit('submit',['class'=>'btn btn-md btn-default'])!!}
{!!Form::close()!!}
Here's the controller. It never hits my getUser function. Just throws the tokenMismatch error.
<?php
namespace App\Http\Controllers;
use App\User;
use App\SecurityQuestions;
use Mail;
use Redirect;
use Illuminate\Http\Response;
use Illuminate\Http\Request;
class PasswordRetrieveController extends Controller{
public function index(){
return view('password.index');
}
public function getUser(Request $request){
$email = $request->get('email');
$user = User::where('email',$email)->first();
if ($user == null){
return Redirect::back()->with('message','This email does not exist');
}
if(($user->password == null) && (!empty($user->provider))){
return Redirect::back()->with('message','A password for this email does not exist. Log back in with facebook or google');
}
else{
$tmp_pw = $this->generate_tmp_pw($user);
return Redirect('password.security_question_1');
}
}
public function security_questions(){
echo 1 ;exit;
}
private function generate_tmp_pw($user){
$tmp_pw= str_random(10);
$user->tmp_password = $tmp_pw;
$user->save();
return $tmp_pw;
}
}
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1MyxP6p
via IFTTT
Aucun commentaire:
Enregistrer un commentaire