Commit | Line | Data |
---|---|---|
1edd3efc FB |
1 | <?php |
2 | $core->url->register('xorgAuth', 'Xorg', '^auth/(.*)$', array('xorgAuthentifier', 'doAuth')); | |
3 | ||
4 | class xorgAuthWidget { | |
5 | static public function widget(&$w) { | |
6 | global $core; | |
7 | if ($core->auth->xorg_infos['forlife']) { | |
8 | return '<p>Tu es ' . $core->auth->xorg_infos['prenom'] . ' ' . $core->auth->xorg_infos['nom'] . '<br />' | |
9 | . '<a href="auth/exit">déconnexion</a></p>'; | |
10 | } else { | |
11 | return '<p><a href="auth/Xorg?path=' . $_SERVER['REQUEST_URI'] . '">M\'authentifier via Polytechnique.org</a></p>'; | |
12 | } | |
13 | } | |
14 | } | |
15 | ||
16 | class xorgAuthentifier extends dcUrlHandlers { | |
17 | static public function doAuth($args) { | |
be74d9bd | 18 | global $core; |
1edd3efc FB |
19 | switch ($args) { |
20 | case 'exit': | |
be74d9bd | 21 | $core->auth->killSession(); |
1edd3efc FB |
22 | break; |
23 | case 'Xorg': | |
e105d162 FB |
24 | if ($core->auth->callXorg($_GET['path'])) { |
25 | header('Location: http://murphy.m4x.org' . $_GET['path']); | |
26 | exit; | |
27 | } | |
1edd3efc FB |
28 | break; |
29 | case 'XorgReturn': | |
be74d9bd | 30 | $core->auth->returnXorg(); |
1edd3efc FB |
31 | break; |
32 | default: | |
33 | self::p404(); | |
34 | } | |
35 | return; | |
36 | } | |
37 | ||
1edd3efc FB |
38 | } |
39 | ?> |