Support the ongoing development of Laravel.io →
posted 10 years ago
Authentication
Last updated 2 years ago.
0

Are you using blade or regular html? If regular html you need this in your form:

<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">

If you are using blade it should work, double check your variable names etc.
Also see: http://laravel.io/forum/11-14-2014-laravel-5-cant-post

Last updated 2 years ago.
0

I believe the issue is actually in the controller as the form is validated and the postRegister method is called but that $user variable is not defined anywhere

Last updated 2 years ago.
0

Could you post here your form you're submitting?

Last updated 2 years ago.
0

Here's my view: (I modified the new default blade escaping syntax)

{{ Form::open() }}
    <!--Email Form Input-->
    <div class="form-group">
        {{ Form::label('email', 'Email:') }}
        {{ Form::email('email', null, ['class' => 'form-control']) }}
    </div>
    
    <!--Password Form Input-->
    <div class="form-group">
        {{ Form::label('password', 'Password:') }}
        {{ Form::password('password', ['class' => 'form-control']) }}
    </div>

    <!--Password Confirmation Form Input-->
    <div class="form-group">
        {{ Form::label('password_confirmation', 'Confirm Password:') }}
        {{ Form::password('password_confirmation', ['class' => 'form-control']) }}
    </div>
    
    <!--Register Form Input-->
    <div class="form-group">
        {{ Form::submit('Register', ['class' => 'btn btn-primary']) }}
    </div>
{{ Form::close() }}
Last updated 2 years ago.
0

Are you sure you are in laravel 5? Because l5 is needing this format in forms:

{!! Form::open(array('url' => 'loggin')) !!}

The {!! !!} to work. Or did you somehow get the

{{     }}

format working.

I get same error, I am now also working on this.

Last updated 2 years ago.
0

Yes, I reverted to the old syntax with:

 Blade::setEchoFormat('%s');
Last updated 2 years ago.
0

I'm new to laravel to:
You need this:

public function postRegister(RegisterRequest $request)
       	{
		// Registration form is valid, create user...
              
               $user =  \App\User::create($request->all());  // add this line
                
                $this->auth->login($user);    

		return redirect('/'); // or to where ever
	}

Record has to be added to database. But first go to your model and setup a setter to hash the password.

See https://laracasts.com/series/whats-new-in-laravel-5/episodes/5

Last updated 2 years ago.
0

I ended up doing this, I use userid, you use email, so yours will be email:

public function postRegister(RegisterRequest $request)
       	{
		// Registration form is valid, create user...
                
             //$user = \App\User::create($request->all());
                $user = new \App\User(); 
                $user->userid = $request->input('userid');
                $user->password = \Illuminate\Support\Facades\Hash::make($request->input('password'));
                $user->save();

                $this->auth->login($user);

		return redirect('pets');  //or where ever here
	}

This worked

Last updated 2 years ago.
0

Thanks, I watched the Laracasts video but when implementing forgot all about manually creating the user. It's working now :)

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

omma2289 omma2289 Joined 18 Nov 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.