2016-10-21 4 views
0

Ich bin neuer in Laravel. Ich habe eine App auf meinem localhost erstellt und diese funktioniert ordnungsgemäß, aber wenn ich sie auf meine Subdomain hochgeladen habe, wird sie nach der Authentifizierung nicht auf das Dashboard umgeleitet. Ich habe die Lösung auf vielen Tutorials auch StackOverflow gelesen aber keine Lösung gefunden. Ich habe meine Laravel-Protokolldatei überprüft, aber es gibt kein Protokoll. Bitte überprüfen Sie unter Code meine Route.Laravel 4.2 Auth funktioniert nicht auf Server-Subdomain?

Route::get('/', function(){ 
if(Auth::check()) 
    return Redirect::route('dashboard'); 
else 
    return View::make('login'); 
}); 
Route::get('/404',array('before'=>'auth','as'=>'404','uses'=>'[email protected]')); 
// 
Route::get('dashboard',array('before'=>'auth','as'=>'dashboard','uses'=>'[email protected]')); 

UserController.php für Benutzer Auth

public function login() 
{ 
    if (Confide::user()) { 
     return Redirect::to('/'); 
    } else { 
     return View::make(Config::get('confide::login_form')); 
    } 
} 

/** 
* Attempt to do login 
* 
* @return Illuminate\Http\Response 
*/ 
public function doLogin() 
{ 
    $repo = App::make('UserRepository'); 
    $input = Input::all(); 
    $dt = $input['email']; 
    if ($dt == "") { 
     $err_msg = Lang::get('confide::confide.alerts.wrong_credentials'); 
     return Redirect::action('[email protected]') 
      ->withInput(Input::except('password')) 
      ->with('error', $err_msg); 
    } 
    if ($repo->login($input)) { 

     $deleted = User::where('email','=',$dt)->first()->deleted; 
     $status = User::where('email','=',$dt)->first()->status; 

     if ($deleted == '1' || $status == '0') { 
      Auth::logout(); 
      return View::make('login')->with(array('message' => 'Account deactivated/deleted,Contact Admin!','level'=>'error')); 
     } 

     return Redirect::intended('/'); 
    } else { 
     if ($repo->existsButNotConfirmed($input)) { 
      $err_msg = Lang::get('confide::confide.alerts.not_confirmed'); 
     } else { 
      $err_msg = Lang::get('confide::confide.alerts.wrong_credentials'); 
     } 

     return Redirect::action('[email protected]') 
      ->withInput(Input::except('password')) 
      ->with('error', $err_msg); 
    } 
} 

und meine .htaccess-Datei

# Force SSL 
<IfModule mod_expires.c> 
ExpiresActive On 
ExpiresByType image/jpg "access 1 year" 
ExpiresByType image/jpeg "access 1 year" 
ExpiresByType image/gif "access 1 year" 
ExpiresByType image/png "access 1 year" 
ExpiresByType text/css "access 1 month" 
ExpiresByType text/html "access 1 month" 
ExpiresByType application/pdf "access 1 month" 
ExpiresByType text/x-javascript "access 1 month" 
ExpiresByType application/x-shockwave-flash "access 1 month" 
ExpiresByType image/x-icon "access 1 year" 
ExpiresDefault "access 1 month" 
</IfModule> 

# 1 Month for most static assets 
<filesMatch ".(css|jpg|jpeg|png|gif|js|ico)$"> 
Header set Cache-Control "max-age=2592000, public" 
</filesMatch> 

<IfModule mod_rewrite.c> 
    <IfModule mod_negotiation.c> 
     Options -MultiViews 
    </IfModule> 

    RewriteRule ^(composer|contributing|artisan) - [F,L,NC] 

    RewriteEngine On 
    # Redirect Trailing Slashes... 
    RewriteRule ^(.*)/$ /$1 [L,R=301] 

    # Handle Front Controller... 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule^index.php [L] 
</IfModule> 

Ich habe bereits mit Domain-Schlüssel in Session-Datei ersetzt .domain.com

Bitte helfen Ich arbeite an den letzten zwei Tagen daran. danke

+0

wie diese aussehen Warum sind Sie Laravel neu, aber Ihre neue App in einer veralteten Version zu erstellen? – ceejayoz

Antwort

0

Sie haben die Routen für die Authentifizierung in Ihrer Routes-Datei nicht angegeben. Auth Routen sollten

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