blob: 3beed6120be814af89f76ebd92b3f97af421f19e (
plain) (
blame)
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
50
|
<?php
/**
* UserFrosting (http://www.userfrosting.com)
*
* @link https://github.com/userfrosting/UserFrosting
* @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License)
*/
namespace UserFrosting\Sprinkle\Admin\Controller;
use UserFrosting\Fortress\RequestDataTransformer;
use UserFrosting\Fortress\RequestSchema;
use UserFrosting\Fortress\ServerSideValidator;
use UserFrosting\Sprinkle\Core\Controller\SimpleController;
use UserFrosting\Support\Exception\ForbiddenException;
use UserFrosting\Support\Exception\BadRequestException;
use UserFrosting\Support\Exception\NotFoundException;
use Slim\Http\Request;
use Slim\Http\Response;
use Slim\Http\UploadedFile;
use Illuminate\Database\Capsule\Manager as DB;
use UserFrosting\Sprinkle\Account\Authenticate\Authenticator;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Session\FileSessionHandler;
use UserFrosting\Session\Session;
/**
* Controller class for user-related requests, including listing users, CRUD for users, etc.
*
* @author Alex Weissman (https://alexanderweissman.com)
*/
class WormholeController extends SimpleController
{
public function verify(Request $request, Response $response, $args) {
$currentUser = $this->ci->currentUser; // FOR DATABASE QUERY
$access_token = $args['access_token'];
if (DB::table('public_keys')
->where('UserID', 1)
->where('Key', '=', $access_token)
->exists()) {
$user_id = $args['user_id'];
$session = new Session();
$session->start();
$response->write($session->all()["account"]["current_user_id"]);
} else {
throw new ForbiddenException();
}
}
}
|