forked from CakeDC/users
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSocialTrait.php
More file actions
49 lines (43 loc) · 1.34 KB
/
Copy pathSocialTrait.php
File metadata and controls
49 lines (43 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
* Copyright 2010 - 2017, Cake Development Corporation (https://www.cakedc.com)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2010 - 2017, Cake Development Corporation (https://www.cakedc.com)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace CakeDC\Users\Controller\Traits;
use Cake\Core\Configure;
use Cake\Network\Exception\NotFoundException;
/**
* Covers registration features and email token validation
*
* @property \Cake\Http\ServerRequest $request
*/
trait SocialTrait
{
/**
* Render the social email form
*
* @throws NotFoundException
* @return mixed
*/
public function socialEmail()
{
if (!$this->request->getSession()->check(Configure::read('Users.Key.Session.social'))) {
throw new NotFoundException();
}
$this->request->getSession()->delete('Flash.auth');
if ($this->request->is('post')) {
$validPost = $this->_validateRegisterPost();
if (!$validPost) {
$this->Flash->error(__d('CakeDC/Users', 'The reCaptcha could not be validated'));
return;
}
$user = $this->Auth->identify();
return $this->_afterIdentifyUser($user, true);
}
}
}