jeudi 5 mai 2016

Registration process runs normally but login view is not working laravel authentication

I am new to laravel. i have seen some related posts but i could not find right answer. I made an auth using php artisan make:auth, i have a directory publicPages. I have changed the auth.login view to my custom publicPages.login and publicPages.register. Registration process works fine, inserts the data into users table. but it does not login the user. When i go to login view and enter credentials. It neither give any error nor log the user in. just redirects it to back.

Here are routes:

Route::auth();
Route::controllers([
    'auth' => 'Auth\AuthController',
    'password' => 'Auth\PasswordController'
]);

Route::group(array('namespace' => 'UserControllers'), function()
{
    Route::group(['middleware' => ['web']], function() {
        Route::group(['middleware' => 'auth'], function () {
        Route::get('community', 'UserController@showCommunity');
        Route::post('communities', 'UserController@addCommunity');
        Route::get('edit/{id}', ['as' => 'edit', 'uses' => 'UserController@editCommunity']);
        Route::get('delete/{id}', 'UserController@deleteCommunity');
        Route::post('update/{id}', ['as' => 'update', 'uses' => 'UserController@updateCommunity']);
        Route::get('create', 'IdeaController@displayPost');
        Route::post('idea', 'IdeaController@storePost');
        Route::get('users', 'UserController@showUserListing');
        Route::get('deleteUser/{id}', 'UserController@deleteUser');
        Route::get('delete/idea/{id}', 'IdeaController@deleteIdea');
        Route::get('approve/{id}', 'IdeaController@approveIdea');
    });
    });

Controller:

class UserController extends Controller {

    //constructor
    public function __construct() {
        $this->middleware('auth');
    }

I know when i would use $this->middleware('auth'); it would redirect to login page for every UserController function. which is working fine.

View:

 <form id="login-form" class="clearfix" action="" method="post">
 <input type="hidden" name="_token" value="">
 <p class="rs pb30">Please Provide your Credentials to Verify Your Identity</p>
 <div class="form form-post-comment">
 <div class="fa-align-center">
 <label for="login_email">
 <input id="login_email" type="email" name="email" class="txt fill-width txt-name" placeholder="Enter Your Email" required="required"/>
 </label>
 @if ($errors->has('email'))
   <span class="help-block">
   <strong></strong>
   </span>
 @endif
 <br><br>
 <label for="password">
 <input id="password" type="password" name="login_password" class="txt fill-width txt-email" placeholder="Enter Your Password" required="required"/>
 </label> <br><br>
 <label for="links">
 <a href="/changepassword" class="txt-emphasis">Forgotten Password?</a>
 <p>Don't have an account? <a href="/register" class="txt-emphasis">Register Here</a> </p>
 </label>
 </div>

 <div class="clear"></div>
 <p >
 <span id="response"></span>
 
 <button class="btn btn-submit-comment" form="login-form">Login</button>
 </p>
 </div>



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1rWBLWd
via IFTTT

Aucun commentaire:

Enregistrer un commentaire