summaryrefslogtreecommitdiffstats
path: root/modules/suitelogin.inc.php
blob: df3b8f059053b43561bc652ad0c5dd7c51158f80 (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
<?php

class Page_SuiteLogin extends Page
{

	protected function doPreprocess()
	{
		if (empty($_SERVER['persistent-id']))
			Util::redirect(CONFIG_PREFIX . 'shib/?do=SuiteLogin');

		if (!Request::any('msg')) {
			$at = Request::any('accessToken');
			if ($at === false || strlen($at) < 20) {
				Message::addError('Missing access token');
			} else {
				$response = ShibAuth::login($at);

				if ($response['status'] === 'ok') {
					Message::addSuccess("Login erfolgreich, Sie können dieses Fenster jetzt schließen");
				} else {
					Message::addError("Login fehlgeschlagen: {{0}}", $response['error']);
					if ($response['status'] === 'unregistered') {
						Util::redirect('?do=Register');
					}
				}
			}
			Util::redirect('?do=SuiteLogin&msg=1');
		}
	}

}