From: root Date: Fri, 19 Nov 2021 20:32:01 +0000 (-0500) Subject: print user name on cas login status page X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b16576ebcb06a5c9c7d5359254ae1a70db2ec044;p=fsfdrupalauth.git print user name on cas login status page --- diff --git a/themes/fsftheme/casserver/loggedIn.php b/themes/fsftheme/casserver/loggedIn.php index ee5bb67..8fe436b 100644 --- a/themes/fsftheme/casserver/loggedIn.php +++ b/themes/fsftheme/casserver/loggedIn.php @@ -27,7 +27,16 @@ $this->includeAtTemplateBase('includes/header.php');

t('{fsfdrupalauth:fsfdrupalauth:loggedin_as_description}') . "..."; + $casconfig = SimpleSAML_Configuration::getConfig('module_casserver.php'); + + $auth = new SimpleSAML\Auth\Simple($casconfig->getValue('authsource')); + $attrs = $auth->getAttributes(); + + if (!isset($attrs['name'][0])) { + throw new Exception('fsfdrupalauth: "name" attribute missing.'); + } + + echo $this->t('{fsfdrupalauth:fsfdrupalauth:loggedin_as_description}') . "" . htmlspecialchars($attrs['name'][0]) . "."; ?>