Subversion Repositories SmartDukaan

Rev

Rev 11677 | Rev 14156 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11677 Rev 14012
Line 88... Line 88...
88
			//end of get cache
88
			//end of get cache
89
			$configdata =array();
89
			$configdata =array();
90
			$configdata = $this->config->item('oauth_login');
90
			$configdata = $this->config->item('oauth_login');
91
			unset($configdata['response'][0]);
91
			unset($configdata['response'][0]);
92
			$data['response']=$this->oauth_model->getLogin($this->input->get(),$this->input->post(),$configdata);
92
			$data['response']=$this->oauth_model->getLogin($this->input->get(),$this->input->post(),$configdata);
-
 
93
			error_log(print_r($data['response']['response'],1));
93
			//set cache to output or renew cache
94
			//set cache to output or renew cache
94
			if(isset($data['response']['response']['login']['authorized']))
95
			if(isset($data['response']['response']['login']['authorized']))
95
			{
96
			{
96
				$this->session->set_userdata('authorized',$data['response']['response']['login']['authorized']);
97
				$this->session->set_userdata('authorized',$data['response']['response']['login']['authorized']);
97
				//$this->session->set_flashdata(array('msg'=>$data['response']['response']['login']['msg']));
98
				//$this->session->set_flashdata(array('msg'=>$data['response']['response']['login']['msg']));
Line 178... Line 179...
178
		
179
		
179
			$configdata =array();
180
			$configdata =array();
180
			$configdata = $this->config->item('oauth_signup');
181
			$configdata = $this->config->item('oauth_signup');
181
			unset($configdata['response'][0]);
182
			unset($configdata['response'][0]);
182
			$data['response']=$this->oauth_model->getLogin($this->input->get(),$this->input->post(),$configdata);
183
			$data['response']=$this->oauth_model->getLogin($this->input->get(),$this->input->post(),$configdata);
-
 
184
			error_log(print_r($data['response']['response'],1));
183
			//set cache to output or renew cache
185
			//set cache to output or renew cache
184
			if(isset($data['response']['response']['signup']['authorized']))
186
			if(isset($data['response']['response']['signup']['authorized']))
185
			{
187
			{
186
				$this->session->set_userdata('authorized',$data['response']['response']['signup']['authorized']);
188
				$this->session->set_userdata('authorized',$data['response']['response']['signup']['authorized']);
187
				$this->session->set_flashdata(array('msg'=>$data['response']['response']['signup']['msg']));
189
				$this->session->set_flashdata(array('msg'=>$data['response']['response']['signup']['msg']));
Line 433... Line 435...
433
            }
435
            }
434
 
436
 
435
        }
437
        }
436
    }
438
    }
437
 
439
 
-
 
440
    public function autologin() {    	
-
 
441
    	$getdata = $this->input->get();
-
 
442
    	if(isset($getdata['next']) && !empty($getdata['next'])){
-
 
443
    		$next = $getdata['next'];
-
 
444
    		$this->session->set_userdata('location',$next);
-
 
445
    	}
-
 
446
    	if(isset($getdata['data']) && !empty($getdata['data'])){
-
 
447
    		$data = $getdata['data'];
-
 
448
    	}else{
-
 
449
    		redirect($next);die;
-
 
450
    	}
-
 
451
    	if(isset($getdata['token']) && !empty($getdata['token'])){
-
 
452
    		$token = $getdata['token'];
-
 
453
    	}else{
-
 
454
    		redirect($next);die;
-
 
455
    	}    	
-
 
456
    	$userData = unserialize(base64_decode($data));
-
 
457
    	$hash = md5("21dtr022015|".$userData['Id']);
-
 
458
    	// echo $hash;
-
 
459
    	// print_r($userData);
-
 
460
    	// echo $token;
-
 
461
    	if($hash != $token){
-
 
462
    		redirect($next);die;
-
 
463
    	}
-
 
464
    	if (isset($_SERVER['HTTP_REFERER'])) {
-
 
465
			if ((strpos($_SERVER['HTTP_REFERER'],'login') == false) && (strpos($_SERVER['HTTP_REFERER'],'register') == false)) {
-
 
466
   				$redirect = $_SERVER['HTTP_REFERER'];
-
 
467
   				$location = $this->session->userdata('location');
-
 
468
   				if(isset($location) && $location == 'shipping'){
-
 
469
   					$data['location'] = 'shipping';
-
 
470
   					$location = base_url().$location;
-
 
471
   					$this->session->set_userdata('location',$location);
-
 
472
   				}elseif(isset($location) && ($location == 'my-recharges' || $location == 'my-wallet')){
-
 
473
   					$location = base_url().$location;
-
 
474
   					$this->session->set_userdata('location',$location);
-
 
475
   				}else{
-
 
476
   					$this->session->set_userdata('location',$redirect);	
-
 
477
   				}
-
 
478
   				
-
 
479
			}
-
 
480
		}
-
 
481
		$this->session->set_userdata('authorized',$userData);
-
 
482
		$location = $this->session->userdata('location');
-
 
483
		if(isset($location) && !empty($location)){
-
 
484
			$this->session->unset_userdata('location');
-
 
485
			redirect($location);
-
 
486
		}
-
 
487
		else{
-
 
488
			redirect(base_url());	
-
 
489
		}
-
 
490
    }
438
}
491
}
439
 
492
 
440
/***** FOR LOGIN AUTHENTICATION *****
493
/***** FOR LOGIN AUTHENTICATION *****
441
*    AUTHORIZE ARRAY + AUTHORIZE[AUTHORITY]=SUCCESS
494
*    AUTHORIZE ARRAY + AUTHORIZE[AUTHORITY]=SUCCESS
442
*	 FOR SIGN UP - 
495
*	 FOR SIGN UP -