public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Trace
data/web/oauth/profile.php
Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.
Author
Date
Commit
Line
Code
1
<?php
2
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
4
if (!$oauth2_server->verifyResourceRequest(OAuth2\Request::createFromGlobals())) {
5
$oauth2_server->getResponse()->send();
6
die;
7
}
8
$token = $oauth2_server->getAccessTokenData(OAuth2\Request::createFromGlobals());
9
$stmt = $pdo->prepare("SELECT * FROM `mailbox` WHERE `username` = :username AND `active` = '1'");
10
$stmt->execute(array(':username' => $token['user_id']));
11
$mailbox = $stmt->fetch(PDO::FETCH_ASSOC);
12
if (!empty($mailbox)) {
13
if ($token['scope'] == 'profile') {
14
header('Content-Type: application/json');
15
echo json_encode(array(
16
'success' => true,
17
'username' => $token['user_id'],
18
'id' => $token['user_id'],
19
'identifier' => $token['user_id'],
20
'email' => (!empty($mailbox['username']) ? $mailbox['username'] : ''),
21
'full_name' => (!empty($mailbox['name']) ? $mailbox['name'] : 'mailcow administrative user'),
22
'displayName' => (!empty($mailbox['name']) ? $mailbox['name'] : 'mailcow administrative user'),
23
'created' => (!empty($mailbox['created']) ? $mailbox['created'] : ''),
24
'modified' => (!empty($mailbox['modified']) ? $mailbox['modified'] : ''),
25
'active' => (!empty($mailbox['active']) ? $mailbox['active'] : ''),
26
));
27
exit;
28
}
29
}
30
echo json_encode(array(
31
'success' => false
32
));