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/authorize.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 (!isset($_SESSION['mailcow_cc_role'])) {
5
$_SESSION['oauth2_request'] = $_SERVER['REQUEST_URI'];
6
header('Location: /?oauth');
7
}
9
$request = OAuth2\Request::createFromGlobals();
10
$response = new OAuth2\Response();
12
if (!$oauth2_server->validateAuthorizeRequest($request, $response)) {
13
$response->send();
14
exit;
15
}
17
if (!isset($_POST['authorized'])) {
18
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php';
20
$template = 'oauth/authorize.twig';
21
$template_data = [];
23
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
24
exit;
25
}
27
// print the authorization code if the user has authorized your client
28
$is_authorized = ($_POST['authorized'] == '1');
29
$oauth2_server->handleAuthorizeRequest($request, $response, $is_authorized, $_SESSION['mailcow_cc_username']);
30
if ($is_authorized) {
31
unset($_SESSION['oauth2_request']);
32
if ($GLOBALS['OAUTH2_FORGET_SESSION_AFTER_LOGIN'] === true) {
33
session_unset();
34
session_destroy();
35
}
36
header('Location: ' . $response->getHttpHeader('Location'));
37
exit;
38
}