0

How can I do the same login and registration form in same page. Like pinterest.com and login users immediately after registration.

I dont know how to do a Manual Authentication, just the default Auth\AuthController

I have this controller, model and view.. throw me errors MethodNotAllowedHttpException in compiled.php line 7717:

model: publish.php

class Publish extends Model implements AuthenticatableContract, CanResetPasswordContract{

    //
    use Authenticatable, CanResetPassword;

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'user_profiles';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = ['email', 'password'];

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = ['password', 'remember_token'];

}

controller: PublishController

use App\Http\Controllers\Controller;
use App\Publicar;
use Auth;
use Request;

class PublishController extends Controller {


    public function index()
    {

        return view('partials.loginCreate', compact('publish'));


    }


     public function authenticate()
    {
        if (Auth::attempt(['email' => $email, 'password' => $password]))
        {
            return redirect()->intended('dashboard');
        }
    }

view: login.blade.php

<form class="form-horizontal" role="form" method="POST" action="{{ url('/publish/authenticate') }}">
                        <input type="hidden" name="_token" value="{{ csrf_token() }}">

                        <div class="form-group">
                            <label class="col-md-4 control-label">E-Mail Address</label>
                            <div class="col-md-6">
                                <input type="email" class="form-control" name="email" value="{{ old('email') }}">
                            </div>
                        </div>

routes.php

Route::get('publish', 'PublishController@index');
Route::get('publish/authenticate', 'PublishController@authenticate');
Route::get('publishLogout', 'PublishController@destroy');
4
  • You'd have to adapt or rewrite the basic scaffolding that comes with the framework. There's not a magical no-code solution. Commented Jun 17, 2015 at 15:55
  • Post your routes.php file Commented Jun 17, 2015 at 17:40
  • thats all the custom login.. Throw errors Commented Jun 17, 2015 at 18:20
  • $user = User::create(...), Auth::login($user). Commented Jun 17, 2015 at 19:48

1 Answer 1

1

Change your route from

Route::get('publish/authenticate', 'PublishController@authenticate');

to

Route::post('publish/authenticate', 'PublishController@authenticate');

because you are posting some data when you are calling authenticate method but the route method you have chosen is get and hence you are getting MethodNotAllowed exception

Sign up to request clarification or add additional context in comments.

2 Comments

solved thanx.. And how can i do.. The Login and registration Form Like pinterest
you need ajax for that if really interested in that I can post the code but I ask you to do some research

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.