Completed
Pull Request — master (#8648)
by Christoph
42:18 queued 25:26
created
core/Controller/CSRFTokenController.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -32,32 +32,32 @@
 block discarded – undo
32 32
 
33 33
 class CSRFTokenController extends Controller {
34 34
 
35
-	/** @var CsrfTokenManager */
36
-	private $tokenManager;
37
-
38
-	/**
39
-	 * @param string $appName
40
-	 * @param IRequest $request
41
-	 * @param CsrfTokenManager $tokenManager
42
-	 */
43
-	public function __construct(string $appName, IRequest $request,
44
-		CsrfTokenManager $tokenManager) {
45
-		parent::__construct($appName, $request);
46
-		$this->tokenManager = $tokenManager;
47
-	}
48
-
49
-	/**
50
-	 * @NoAdminRequired
51
-	 * @NoCSRFRequired
52
-	 * @PublicPage
53
-	 * @return JSONResponse
54
-	 */
55
-	public function index(): JSONResponse {
56
-		$requestToken = $this->tokenManager->getToken();
57
-
58
-		return new JSONResponse([
59
-			'token' => $requestToken->getEncryptedValue(),
60
-		]);
61
-	}
35
+    /** @var CsrfTokenManager */
36
+    private $tokenManager;
37
+
38
+    /**
39
+     * @param string $appName
40
+     * @param IRequest $request
41
+     * @param CsrfTokenManager $tokenManager
42
+     */
43
+    public function __construct(string $appName, IRequest $request,
44
+        CsrfTokenManager $tokenManager) {
45
+        parent::__construct($appName, $request);
46
+        $this->tokenManager = $tokenManager;
47
+    }
48
+
49
+    /**
50
+     * @NoAdminRequired
51
+     * @NoCSRFRequired
52
+     * @PublicPage
53
+     * @return JSONResponse
54
+     */
55
+    public function index(): JSONResponse {
56
+        $requestToken = $this->tokenManager->getToken();
57
+
58
+        return new JSONResponse([
59
+            'token' => $requestToken->getEncryptedValue(),
60
+        ]);
61
+    }
62 62
 
63 63
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 /**
5 5
  * @copyright 2017 Christoph Wurst <[email protected]>
Please login to merge, or discard this patch.
core/routes.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -36,45 +36,45 @@  discard block
 block discarded – undo
36 36
 
37 37
 $application = new Application();
38 38
 $application->registerRoutes($this, [
39
-	'routes' => [
40
-		['name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'],
41
-		['name' => 'lost#resetform', 'url' => '/lostpassword/reset/form/{token}/{userId}', 'verb' => 'GET'],
42
-		['name' => 'lost#setPassword', 'url' => '/lostpassword/set/{token}/{userId}', 'verb' => 'POST'],
43
-		['name' => 'user#getDisplayNames', 'url' => '/displaynames', 'verb' => 'POST'],
44
-		['name' => 'avatar#getAvatar', 'url' => '/avatar/{userId}/{size}', 'verb' => 'GET'],
45
-		['name' => 'avatar#deleteAvatar', 'url' => '/avatar/', 'verb' => 'DELETE'],
46
-		['name' => 'avatar#postCroppedAvatar', 'url' => '/avatar/cropped', 'verb' => 'POST'],
47
-		['name' => 'avatar#getTmpAvatar', 'url' => '/avatar/tmp', 'verb' => 'GET'],
48
-		['name' => 'avatar#postAvatar', 'url' => '/avatar/', 'verb' => 'POST'],
49
-		['name' => 'CSRFToken#index', 'url' => '/csrftoken', 'verb' => 'GET'],
50
-		['name' => 'login#tryLogin', 'url' => '/login', 'verb' => 'POST'],
51
-		['name' => 'login#confirmPassword', 'url' => '/login/confirm', 'verb' => 'POST'],
52
-		['name' => 'login#showLoginForm', 'url' => '/login', 'verb' => 'GET'],
53
-		['name' => 'login#logout', 'url' => '/logout', 'verb' => 'GET'],
54
-		['name' => 'ClientFlowLogin#showAuthPickerPage', 'url' => '/login/flow', 'verb' => 'GET'],
55
-		['name' => 'ClientFlowLogin#redirectPage', 'url' => '/login/flow/redirect', 'verb' => 'GET'],
56
-		['name' => 'ClientFlowLogin#generateAppPassword', 'url' => '/login/flow', 'verb' => 'POST'],
57
-		['name' => 'TwoFactorChallenge#selectChallenge', 'url' => '/login/selectchallenge', 'verb' => 'GET'],
58
-		['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'],
59
-		['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'],
60
-		['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'],
61
-		['name' => 'Preview#getPreviewByFileId', 'url' => '/core/preview', 'verb' => 'GET'],
62
-		['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'],
63
-		['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'],
64
-		['name' => 'Js#getJs', 'url' => '/js/{appName}/{fileName}', 'verb' => 'GET'],
65
-		['name' => 'contactsMenu#index', 'url' => '/contactsmenu/contacts', 'verb' => 'POST'],
66
-		['name' => 'contactsMenu#findOne', 'url' => '/contactsmenu/findOne', 'verb' => 'POST'],
67
-		['name' => 'AutoComplete#get', 'url' => 'autocomplete/get', 'verb' => 'GET'],
68
-		['name' => 'WalledGarden#get', 'url' => '/204', 'verb' => 'GET'],
69
-	],
70
-	'ocs' => [
71
-		['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'],
72
-		['root' => '', 'name' => 'OCS#getConfig', 'url' => '/config', 'verb' => 'GET'],
73
-		['root' => '/person', 'name' => 'OCS#personCheck', 'url' => '/check', 'verb' => 'POST'],
74
-		['root' => '/identityproof', 'name' => 'OCS#getIdentityProof', 'url' => '/key/{cloudId}', 'verb' => 'GET'],
75
-		['root' => '/core', 'name' => 'Navigation#getAppsNavigation', 'url' => '/navigation/apps', 'verb' => 'GET'],
76
-		['root' => '/core', 'name' => 'Navigation#getSettingsNavigation', 'url' => '/navigation/settings', 'verb' => 'GET'],
77
-	],
39
+    'routes' => [
40
+        ['name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'],
41
+        ['name' => 'lost#resetform', 'url' => '/lostpassword/reset/form/{token}/{userId}', 'verb' => 'GET'],
42
+        ['name' => 'lost#setPassword', 'url' => '/lostpassword/set/{token}/{userId}', 'verb' => 'POST'],
43
+        ['name' => 'user#getDisplayNames', 'url' => '/displaynames', 'verb' => 'POST'],
44
+        ['name' => 'avatar#getAvatar', 'url' => '/avatar/{userId}/{size}', 'verb' => 'GET'],
45
+        ['name' => 'avatar#deleteAvatar', 'url' => '/avatar/', 'verb' => 'DELETE'],
46
+        ['name' => 'avatar#postCroppedAvatar', 'url' => '/avatar/cropped', 'verb' => 'POST'],
47
+        ['name' => 'avatar#getTmpAvatar', 'url' => '/avatar/tmp', 'verb' => 'GET'],
48
+        ['name' => 'avatar#postAvatar', 'url' => '/avatar/', 'verb' => 'POST'],
49
+        ['name' => 'CSRFToken#index', 'url' => '/csrftoken', 'verb' => 'GET'],
50
+        ['name' => 'login#tryLogin', 'url' => '/login', 'verb' => 'POST'],
51
+        ['name' => 'login#confirmPassword', 'url' => '/login/confirm', 'verb' => 'POST'],
52
+        ['name' => 'login#showLoginForm', 'url' => '/login', 'verb' => 'GET'],
53
+        ['name' => 'login#logout', 'url' => '/logout', 'verb' => 'GET'],
54
+        ['name' => 'ClientFlowLogin#showAuthPickerPage', 'url' => '/login/flow', 'verb' => 'GET'],
55
+        ['name' => 'ClientFlowLogin#redirectPage', 'url' => '/login/flow/redirect', 'verb' => 'GET'],
56
+        ['name' => 'ClientFlowLogin#generateAppPassword', 'url' => '/login/flow', 'verb' => 'POST'],
57
+        ['name' => 'TwoFactorChallenge#selectChallenge', 'url' => '/login/selectchallenge', 'verb' => 'GET'],
58
+        ['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'],
59
+        ['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'],
60
+        ['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'],
61
+        ['name' => 'Preview#getPreviewByFileId', 'url' => '/core/preview', 'verb' => 'GET'],
62
+        ['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'],
63
+        ['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'],
64
+        ['name' => 'Js#getJs', 'url' => '/js/{appName}/{fileName}', 'verb' => 'GET'],
65
+        ['name' => 'contactsMenu#index', 'url' => '/contactsmenu/contacts', 'verb' => 'POST'],
66
+        ['name' => 'contactsMenu#findOne', 'url' => '/contactsmenu/findOne', 'verb' => 'POST'],
67
+        ['name' => 'AutoComplete#get', 'url' => 'autocomplete/get', 'verb' => 'GET'],
68
+        ['name' => 'WalledGarden#get', 'url' => '/204', 'verb' => 'GET'],
69
+    ],
70
+    'ocs' => [
71
+        ['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'],
72
+        ['root' => '', 'name' => 'OCS#getConfig', 'url' => '/config', 'verb' => 'GET'],
73
+        ['root' => '/person', 'name' => 'OCS#personCheck', 'url' => '/check', 'verb' => 'POST'],
74
+        ['root' => '/identityproof', 'name' => 'OCS#getIdentityProof', 'url' => '/key/{cloudId}', 'verb' => 'GET'],
75
+        ['root' => '/core', 'name' => 'Navigation#getAppsNavigation', 'url' => '/navigation/apps', 'verb' => 'GET'],
76
+        ['root' => '/core', 'name' => 'Navigation#getSettingsNavigation', 'url' => '/navigation/settings', 'verb' => 'GET'],
77
+    ],
78 78
 ]);
79 79
 
80 80
 // Post installation check
@@ -83,15 +83,15 @@  discard block
 block discarded – undo
83 83
 // Core ajax actions
84 84
 // Search
85 85
 $this->create('search_ajax_search', '/core/search')
86
-	->actionInclude('core/search/ajax/search.php');
86
+    ->actionInclude('core/search/ajax/search.php');
87 87
 // Routing
88 88
 $this->create('core_ajax_update', '/core/ajax/update.php')
89
-	->actionInclude('core/ajax/update.php');
89
+    ->actionInclude('core/ajax/update.php');
90 90
 
91 91
 // File routes
92 92
 $this->create('files.viewcontroller.showFile', '/f/{fileid}')->action(function($urlParams) {
93
-	$app = new \OCA\Files\AppInfo\Application($urlParams);
94
-	$app->dispatch('ViewController', 'index');
93
+    $app = new \OCA\Files\AppInfo\Application($urlParams);
94
+    $app->dispatch('ViewController', 'index');
95 95
 });
96 96
 
97 97
 // Call routes
@@ -100,52 +100,52 @@  discard block
 block discarded – undo
100 100
  * @suppress PhanUndeclaredClassMethod
101 101
  */
102 102
 $this->create('spreed.pagecontroller.showCall', '/call/{token}')->action(function($urlParams) {
103
-	if (class_exists(\OCA\Spreed\AppInfo\Application::class, false)) {
104
-		$app = new \OCA\Spreed\AppInfo\Application($urlParams);
105
-		$app->dispatch('PageController', 'index');
106
-	} else {
107
-		throw new \OC\HintException('App spreed is not enabled');
108
-	}
103
+    if (class_exists(\OCA\Spreed\AppInfo\Application::class, false)) {
104
+        $app = new \OCA\Spreed\AppInfo\Application($urlParams);
105
+        $app->dispatch('PageController', 'index');
106
+    } else {
107
+        throw new \OC\HintException('App spreed is not enabled');
108
+    }
109 109
 });
110 110
 
111 111
 // Sharing routes
112 112
 $this->create('files_sharing.sharecontroller.showShare', '/s/{token}')->action(function($urlParams) {
113
-	if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
114
-		$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
115
-		$app->dispatch('ShareController', 'showShare');
116
-	} else {
117
-		throw new \OC\HintException('App file sharing is not enabled');
118
-	}
113
+    if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
114
+        $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
115
+        $app->dispatch('ShareController', 'showShare');
116
+    } else {
117
+        throw new \OC\HintException('App file sharing is not enabled');
118
+    }
119 119
 });
120 120
 $this->create('files_sharing.sharecontroller.authenticate', '/s/{token}/authenticate/{redirect}')->post()->action(function($urlParams) {
121
-	if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
122
-		$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
123
-		$app->dispatch('ShareController', 'authenticate');
124
-	} else {
125
-		throw new \OC\HintException('App file sharing is not enabled');
126
-	}
121
+    if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
122
+        $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
123
+        $app->dispatch('ShareController', 'authenticate');
124
+    } else {
125
+        throw new \OC\HintException('App file sharing is not enabled');
126
+    }
127 127
 });
128 128
 $this->create('files_sharing.sharecontroller.showAuthenticate', '/s/{token}/authenticate/{redirect}')->get()->action(function($urlParams) {
129
-	if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
130
-		$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
131
-		$app->dispatch('ShareController', 'showAuthenticate');
132
-	} else {
133
-		throw new \OC\HintException('App file sharing is not enabled');
134
-	}
129
+    if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
130
+        $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
131
+        $app->dispatch('ShareController', 'showAuthenticate');
132
+    } else {
133
+        throw new \OC\HintException('App file sharing is not enabled');
134
+    }
135 135
 });
136 136
 $this->create('files_sharing.sharecontroller.downloadShare', '/s/{token}/download')->get()->action(function($urlParams) {
137
-	if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
138
-		$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
139
-		$app->dispatch('ShareController', 'downloadShare');
140
-	} else {
141
-		throw new \OC\HintException('App file sharing is not enabled');
142
-	}
137
+    if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
138
+        $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
139
+        $app->dispatch('ShareController', 'downloadShare');
140
+    } else {
141
+        throw new \OC\HintException('App file sharing is not enabled');
142
+    }
143 143
 });
144 144
 $this->create('files_sharing.publicpreview.directLink', '/s/{token}/preview')->get()->action(function($urlParams) {
145
-	if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
146
-		$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
147
-		$app->dispatch('PublicPreviewController', 'directLink');
148
-	} else {
149
-		throw new \OC\HintException('App file sharing is not enabled');
150
-	}
145
+    if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
146
+        $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
147
+        $app->dispatch('PublicPreviewController', 'directLink');
148
+    } else {
149
+        throw new \OC\HintException('App file sharing is not enabled');
150
+    }
151 151
 });
Please login to merge, or discard this patch.