Subversion Repositories SmartDukaan

Rev

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

Rev 14019 Rev 14150
Line 25... Line 25...
25
		$this->set('title_for_layout','Profittill Bookmarklet');
25
		$this->set('title_for_layout','Profittill Bookmarklet');
26
	}
26
	}
27
 
27
 
28
	public function mywallet() {
28
	public function mywallet() {
29
		$userId = $this->request->query('user_id');
29
		$userId = $this->request->query('user_id');
30
		if(isset($userId) && !empty($userId)){
30
		if(isset($userId) && !empty($userId)){	
31
			$this->loadModel('User');
-
 
32
			$this->User->Behaviors->attach('Containable');
-
 
33
			$options = array('contain'=>array('UserAccount'=>array('conditions'=>array('account_type'=>'saholic'))), 'conditions'=>array('User.id'=>$userId),'fields'=>array('username','email'),'recursive'=>-1);
-
 
34
			$user = $this->User->find('first',$options);
-
 
35
			// debug($user);die;
-
 
36
			$data = array('email'=>$user['User']['email'],'Id'=>$user['UserAccount'][0]['account_key'],'isPrivateDealUser'=>1);
-
 
37
			$data = '?data='.base64_encode(serialize($data));
-
 
38
			$token = '&token='.md5(Configure::read('saholicapikey').'|'.$user['UserAccount'][0]['account_key']);
-
 
39
			$next = "&next=/my-wallet";
31
			$next = "&next=/my-wallet";					
40
			$redirectUrl = Configure::read('saholicauthurl').$data.$token.$next;
32
			$redirectUrl = $this->getAutoLoginUrl($userId,$next);
41
			header('location:'.$redirectUrl);
33
			header('location:'.$redirectUrl);
42
			exit();
34
			exit();
43
		}
35
		}
44
	}
36
	}
45
 
37
 
Line 514... Line 506...
514
		$user = $this->User->read(null,$userId);
506
		$user = $this->User->read(null,$userId);
515
		$this->Auth->login($user['User']);
507
		$this->Auth->login($user['User']);
516
		$json = array('success'=>true);
508
		$json = array('success'=>true);
517
		$this->response->type('json');
509
		$this->response->type('json');
518
		$this->layout = 'ajax';
510
		$this->layout = 'ajax';
519
		    echo(json_encode($json));die;
511
	    echo(json_encode($json));die;
520
	}
512
	}
521
}
513
}