Subversion Repositories SmartDukaan

Rev

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

Rev 13900 Rev 14019
Line 11... Line 11...
11
 
11
 
12
    public function beforeFilter() {
12
    public function beforeFilter() {
13
    	parent::beforeFilter();
13
    	parent::beforeFilter();
14
    	// $this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'dashboard');
14
    	// $this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'dashboard');
15
    	$this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'display','home');
15
    	$this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'display','home');
16
        $this->Auth->allow(array('mine','login', 'forgotten_password', 'register', 'activate', 'checkemail','checkfbuser','registertwitteruser','skipmobileverification','reauthenticate','edit')); 
16
        $this->Auth->allow(array('mine','login', 'forgotten_password', 'register', 'activate', 'checkemail','checkfbuser','registertwitteruser','skipmobileverification','reauthenticate','edit','mywallet')); 
17
		$this->Cookie->name = 'profittill';
17
		$this->Cookie->name = 'profittill';
18
		$this->Cookie->time = 86400*30; 
18
		$this->Cookie->time = 86400*30; 
19
		$this->Cookie->path = '/';
19
		$this->Cookie->path = '/';
20
		$this->Cookie->key = 'qSI232qs*&sXOw!adre@34SAv!@*(XSL#$%)asGb$@11~_+!@#H23s~#^';
20
		$this->Cookie->key = 'qSI232qs*&sXOw!adre@34SAv!@*(XSL#$%)asGb$@11~_+!@#H23s~#^';
21
		$this->Cookie->httpOnly = true;
21
		$this->Cookie->httpOnly = true;
Line 23... Line 23...
23
    
23
    
24
	public function bookmarklet() {
24
	public function bookmarklet() {
25
		$this->set('title_for_layout','Profittill Bookmarklet');
25
		$this->set('title_for_layout','Profittill Bookmarklet');
26
	}
26
	}
27
 
27
 
-
 
28
	public function mywallet() {
-
 
29
		$userId = $this->request->query('user_id');
-
 
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";
-
 
40
			$redirectUrl = Configure::read('saholicauthurl').$data.$token.$next;
-
 
41
			header('location:'.$redirectUrl);
-
 
42
			exit();
-
 
43
		}
-
 
44
	}
-
 
45
 
28
	public function mine() {
46
	public function mine() {
29
		$this->response->type('json');
47
		$this->response->type('json');
30
		$this->layout = 'ajax';
48
		$this->layout = 'ajax';
31
		$userId = $this->request->query('user_id');
49
		$userId = $this->request->query('user_id');
32
		if(isset($userId) && !empty($userId)){
50
		if(isset($userId) && !empty($userId)){