Closed thusfar7 closed 8 years ago
Can you check these issues first : #39 & #34
Check also this: https://github.com/ARCANEDEV/Localization/issues/58#issuecomment-244463420
Okay so. As you can see my routes are properly defined.
Moving POST routes outside Localization group doesnt help.
Basically what happens is that "Login POST" redirects me to "home" route and from there to localized home route.
OK, can you tell me the Laravel version you're using ?
How did you register this routes ? with a RouteServiceProvider
like this example ?
This is the proper way to register localized route:
$router->localizedGroup(function($router) {
$router->group([
'as' => 'auth::',
'namespace' => 'Auth',
],
function ($router) {
// Authentication Routes...
$router->group(['prefix' => 'login', 'as' => 'login.'], function ($router) {
// auth::login.get
$router->get('/', ['as' => 'get', 'uses' => 'LoginController@showLoginForm']);
// auth::login.post
$router->post('/', ['as' => 'post', 'uses' => 'LoginController@login']);
});
// auth::logout
$router->get('logout', ['as' => 'logout', 'uses' => 'LoginController@logout']);
// Registration Routes...
$router->group(['prefix' => 'register', 'as' => 'register.'], function ($router) {
// auth::register.get
$router->get('/', ['as' => 'get', 'uses' => 'RegisterController@showRegistrationForm']);
// auth::register.post
$router->post('/', ['as' => 'post', 'uses' => 'RegisterController@register']);
});
}
);
});
Make sure you're using route names in your form's action to avoid redirections while posting a form, like this:
<form action="{{ route('auth::login.post') }}" method="POST" class="form-horizontal" role="form">
Just follow this https://github.com/ARCANEDEV/Localization/issues/58#issuecomment-244463420 (Tested with Laravel 5.2) and you're going to be fine.
I use 5.2. My auth routes look the same as in #58 as well as login view. Still it doesnt work.
So you're using this:
$router->localizedGroup(function($router) {
//...
});
instead of this:
$router->group([
'prefix' => Localization::setLocale(),
'middleware' => [
'web',
'localization-session-redirect',
'localization-redirect',
],
], function($router) {
//...
});
Did you tried to debug your LoginController
and especially the login
method (see here) ?
Did you changed the base code of \Illuminate\Foundation\Auth\AuthenticatesUsers
Trait ?
Try to check each line like validateLogin()
, getCredentials()
, sendFailedLoginResponse()
etc...
I've tested the localization package (on September) with a fresh Laravel 5.2 installation and it works without a problem.
I localized all Auth routes.
When I go to Login and enter wrong credentials and submit it, I get redirected to home route? Any ideas or suggestion to why this might be happening?