PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Wed Oct 16, 2019 4:44 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Sat Mar 26, 2016 10:17 pm 
Offline
Forum Newbie

Joined: Sat Mar 26, 2016 8:52 pm
Posts: 1
I'm working on a Laravel authentication system, and while registration works and logs the user in, and creates entries in the database, but login doesn't do anything -it just returns to the login page. I've included the Laravel project folder zipped on Google drive so you can look at any potential causes short of server configuration directly if you set up your own database. Note that this problem existed before I added jQuery mobile, so it's not AJAX loads.

[url]
https://drive.google.com/file/d/0BzXcUh ... sp=sharing\[/url]

AuthController
Syntax: [ Download ] [ Hide ]
<?php

namespace App\Http\Controllers\Auth;

use App\User;
use Validator;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;

class AuthController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Registration & Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles the registration of new users, as well as the
    | authentication of existing users. By default, this controller uses
    | a simple trait to add these behaviors. Why don't you explore it?
    |
    */


    use AuthenticatesAndRegistersUsers;

    /**
     * Create a new authentication controller instance.
     *
     * @return void
     */

    public function __construct()
    {
        $this->middleware('guest', ['except' => 'getLogout']);
    }
    protected $redirectPath = '/product';
    /**
     * Get a validator for an incoming registration request.
     *
     * @param  array  $data
     * @return \Illuminate\Contracts\Validation\Validator
     */

    protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => 'required|max:255',
            'email' => 'required|email|max:255|unique:users',
            'password' => 'required|confirmed|min:6',
        ]);
    }

    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return User
     */

    protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
        ]);
    }
}

And routes.php:
Syntax: [ Download ] [ Hide ]
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/


/*Route::get('/', function () {
    return view('welcome');
});*/

Route::get('/', 'WelcomeController@index');

Route::get("home", function (){ return view('welcome');} );
Route::get("checkuser", function() {return Auth::user(); });

//Route::get('product', 'WelcomeController@product');
//Route::controller('WelcomeController');

//product routes
Route::get("products", 'ProductController@products');
Route::get("product/{id}", 'ProductController@product');
// Authentication routes...
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');

// Registration routes...
Route::get('auth/register', 'Auth\AuthController@getRegister');
Route::post('auth/register', 'Auth\AuthController@postRegister');

Login.blade.php
Syntax: [ Download ] [ Hide ]
@extends('master.master')

@section('content')
<div id='login-form'>
<form method="POST" action='{!! url("auth/register")!!}' data-ajax="false">
    {!! csrf_field() !!}

    <div id='emailBox'>
        <label for='email'>Email:</label>
        <input name='email' id='email' type='email' value="{{ old('email') }}"/>
    </div>
    <div id='passBox'>
        <label for='password'>Password</label>
        <input name='password' id='password' type='password' />
    </div>

    <div id='rememberBox'>
        <label for='remember'>Remember Me!</label>
        <input name='remember' id='remember' type='checkbox' />
    </div>
    <div id='loginBox'>
            <input type="submit" value="Log In!" id='loginButton' class='cloudButton'>
    </div>
</form>
</div>
 

register.blade.php
Syntax: [ Download ] [ Hide ]
@extends('master.master')

@section('content')
<div id='register'>
    <form method="post" action='{!! url("auth/register")!!}' data-ajax="false">
        {!! csrf_field() !!}

        <div id='nameBox'>
            <label for='name'>First Name:</label> <input name='name' id='name'
                type='text'>
        </div>
        <div id='emailBox'>
            <label for='email'>Email:</label> <input name='email' id='email'
                type='email' value="{{ old('email') }}" />
        </div>
        <div id='passBox'>
            <label for='password'>Password:</label> <input name='password'
                id='password' type='password' />
        </div>

        <div id="confirmBox">
            <label for='password'>Confirm Password:</label>
            <input type="password" name="password_confirmation">
        </div>
        <div id='signUpBox'>
            <input type="submit" value="Sign Up!" id='signUpButton' class='cloudButton'>
        </div>
    </form>
</div>
@stop


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group