| Line 259... |
Line 259... |
| 259 |
}
|
259 |
}
|
| 260 |
}
|
260 |
}
|
| 261 |
|
261 |
|
| 262 |
//social login process
|
262 |
//social login process
|
| 263 |
public function session($provider)
|
263 |
public function session($provider)
|
| 264 |
{
|
264 |
{
|
| 265 |
// if (isset($_SERVER['HTTP_REFERER'])) {
|
265 |
// if (isset($_SERVER['HTTP_REFERER'])) {
|
| 266 |
// if(strpos($_SERVER['HTTP_REFERER'],'session') == false) {
|
266 |
// if(strpos($_SERVER['HTTP_REFERER'],'session') == false) {
|
| 267 |
// $location = $_SERVER['HTTP_REFERER'];
|
267 |
// $location = $_SERVER['HTTP_REFERER'];
|
| 268 |
// $this->session->set_userdata('location',$location);
|
268 |
// $this->session->set_userdata('location',$location);
|
| 269 |
// }
|
269 |
// }
|
| Line 301... |
Line 301... |
| 301 |
if(strcasecmp('facebook', $type) == 0){
|
301 |
if(strcasecmp('facebook', $type) == 0){
|
| 302 |
$_POST['isFacebookUser'] = 'true';
|
302 |
$_POST['isFacebookUser'] = 'true';
|
| 303 |
$_POST['accessToken'] = $user['access_token'];
|
303 |
$_POST['accessToken'] = $user['access_token'];
|
| 304 |
$_POST['facebookId'] = $user['uid'];
|
304 |
$_POST['facebookId'] = $user['uid'];
|
| 305 |
$_POST['email'] = $user['email'];
|
305 |
$_POST['email'] = $user['email'];
|
| - |
|
306 |
if (preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$_POST['email'])) {
|
| 306 |
$authorized = $this->session->userdata('authorized');
|
307 |
$authorized = $this->session->userdata('authorized');
|
| 307 |
if(isset($_POST) && !empty($_POST)){
|
308 |
if(isset($_POST) && !empty($_POST)){
|
| 308 |
if(isset($authorized) && !empty($authorized)){
|
309 |
if(isset($authorized) && !empty($authorized)){
|
| 309 |
$_POST['userId'] = $authorized['Id'];
|
310 |
$_POST['userId'] = $authorized['Id'];
|
| 310 |
$_POST['Id'] = $authorized['cartId'];
|
311 |
$_POST['Id'] = $authorized['cartId'];
|
| 311 |
if($authorized['isLoggedIn'] == 1){
|
312 |
if($authorized['isLoggedIn'] == 1){
|
| 312 |
$_POST['isLoggedIn'] = 'true';
|
313 |
$_POST['isLoggedIn'] = 'true';
|
| - |
|
314 |
}
|
| - |
|
315 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
| - |
|
316 |
$_POST['isLoggedIn'] = 'false';
|
| - |
|
317 |
}
|
| 313 |
}
|
318 |
}
|
| - |
|
319 |
}
|
| - |
|
320 |
$data['response']=$this->oauth_model->getLogin($this->input->get(),$this->input->post(),$this->config->item('oauth_login'));
|
| - |
|
321 |
if(isset($data['response']['response']['login']['authorized']))
|
| - |
|
322 |
{
|
| - |
|
323 |
$this->session->set_userdata('authorized',$data['response']['response']['login']['authorized']);
|
| - |
|
324 |
$this->session->set_flashdata(array('msg'=>$data['response']['response']['login']['msg']));
|
| - |
|
325 |
$location = $this->session->userdata('location');
|
| 314 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
326 |
if(isset($location) && !empty($location)){
|
| 315 |
$_POST['isLoggedIn'] = 'false';
|
327 |
$this->session->unset_userdata('location');
|
| - |
|
328 |
redirect($location);
|
| - |
|
329 |
}
|
| - |
|
330 |
else{
|
| - |
|
331 |
redirect(base_url().$data['response']['response']['login']['redirect']);
|
| 316 |
}
|
332 |
}
|
| 317 |
}
|
333 |
}
|
| - |
|
334 |
else
|
| - |
|
335 |
{
|
| - |
|
336 |
$inputfile = base_url().'assets/css/auth.less';
|
| - |
|
337 |
$outputfile = base_url().'assets/css/auth.less';
|
| - |
|
338 |
$this->lessphp->object()->ccompile('assets/css/auth.less','assets/css/auth.css');
|
| - |
|
339 |
$data['stylesheet'] = 'auth.css';
|
| - |
|
340 |
$this->layout->view(strtolower(__CLASS__).'/oauth_view',$data);
|
| - |
|
341 |
}
|
| - |
|
342 |
}else{
|
| - |
|
343 |
$this->session->set_flashdata(array('msg'=>'Some problem occured.Please try again!'));
|
| - |
|
344 |
redirect(base_url().'login');
|
| 318 |
}
|
345 |
}
|
| 319 |
}
|
- |
|
| 320 |
$data['response']=$this->oauth_model->getLogin($this->input->get(),$this->input->post(),$this->config->item('oauth_login'));
|
- |
|
| 321 |
if(isset($data['response']['response']['login']['authorized']))
|
- |
|
| 322 |
{
|
- |
|
| 323 |
$this->session->set_userdata('authorized',$data['response']['response']['login']['authorized']);
|
- |
|
| 324 |
$this->session->set_flashdata(array('msg'=>$data['response']['response']['login']['msg']));
|
- |
|
| 325 |
$location = $this->session->userdata('location');
|
- |
|
| 326 |
if(isset($location) && !empty($location)){
|
- |
|
| 327 |
$this->session->unset_userdata('location');
|
- |
|
| 328 |
redirect($location);
|
- |
|
| 329 |
}
|
- |
|
| 330 |
else{
|
- |
|
| 331 |
redirect(base_url().$data['response']['response']['login']['redirect']);
|
- |
|
| 332 |
}
|
- |
|
| 333 |
}
|
- |
|
| 334 |
else
|
- |
|
| 335 |
{
|
- |
|
| 336 |
$inputfile = base_url().'assets/css/auth.less';
|
- |
|
| 337 |
$outputfile = base_url().'assets/css/auth.less';
|
- |
|
| 338 |
$this->lessphp->object()->ccompile('assets/css/auth.less','assets/css/auth.css');
|
- |
|
| 339 |
$data['stylesheet'] = 'auth.css';
|
- |
|
| 340 |
$this->layout->view(strtolower(__CLASS__).'/oauth_view',$data);
|
- |
|
| 341 |
}
|
346 |
}
|
| 342 |
// Here you should use this information to A) look for a user B) help a new user sign up with existing data.
|
347 |
// Here you should use this information to A) look for a user B) help a new user sign up with existing data.
|
| 343 |
// If you store it all in a cookie and redirect to a registration page this is crazy-simple.
|
348 |
// If you store it all in a cookie and redirect to a registration page this is crazy-simple.
|
| 344 |
//echo "<pre>Tokens: ";
|
349 |
//echo "<pre>Tokens: ";
|
| 345 |
//var_dump($token);
|
350 |
//var_dump($token);
|