authentication - laravel 4 logout after loginning directly? -
i try login email , password auth::attempt success login when redirect link after login logout , on localhost things when upload project on host problem occured
login function
public function login(){ $validator=validator::make(input::all(),array( 'email' => 'email|required', 'password' => 'required' )); if($validator->fails()){ $messages = $validator->messages(); $msg=''; foreach ($messages->all() $message) { $msg .= "<li>".$message."</li><br />"; } return $msg; } else{ $email = input::get('email'); $password = input::get('password'); $user=auth::attempt(array( 'email' => $email, 'password' => $password, 'activated' => 1 ),true); //die(auth::user()->rule); if($user){ //auth::login($user); //die('1111111111'); return 1; } else{ return "يوجد خطأ فى البريد الإلكترونى أو كلمة المرور"; } //die('11111111111111111'); } }
model
<?php use illuminate\auth\userinterface; use illuminate\auth\reminders\remindableinterface; use mmanos\social\socialtrait; class user extends eloquent implements userinterface, remindableinterface { use socialtrait; protected $fillable = array('username','password','rule', 'email','active','phone','address','add_info','image','first_name','sec_name','country','area','baqah_id'); /** * database table used model. * * @var string */ protected $table = 'users'; public static function is_admin(){ if(auth::user()->rule=='admin'){ return true; } return false; } /* 1 one relation */ /** * attributes excluded model's json form. * * @var array */ protected $hidden = array('password'); /** * unique identifier user. * * @return mixed */ public function getauthidentifier() { return $this->getkey(); } /** * password user. * * @return string */ public function getauthpassword() { return $this->password; } /** * e-mail address password reminders sent. * * @return string */ public function getreminderemail() { return $this->email; } public function getremembertoken() { return $this->remember_token; } public function setremembertoken($value) { $this->remember_token = $value; } public function getremembertokenname() { return 'remember_token'; } }
?>
Comments
Post a Comment