From daf05e825f640d9bfc6b1fb2bb392faf57a5d69b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20P=C3=A9rez=20Crespo?= <jaime.perez@uninett.no> Date: Thu, 21 Mar 2013 09:04:47 +0000 Subject: [PATCH] Fixes for issues #539, #540, #541 and #542. Thanks to Thijs Kinkhorst for the patches. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@3229 44740490-163a-0410-bde0-09ae8108e29a --- modules/core/hooks/hook_sanitycheck.php | 2 +- modules/core/templates/frontpage_auth.tpl.php | 4 +-- .../core/templates/frontpage_config.tpl.php | 4 +-- .../templates/frontpage_federation.tpl.php | 4 +-- .../core/templates/frontpage_welcome.tpl.php | 4 +-- modules/core/templates/loginuserpass.php | 21 +++++------ modules/saml/www/sp/metadata.php | 33 +++++++++-------- .../sanitycheck/hooks/hook_sanitycheck.php | 4 +-- templates/includes/footer.php | 14 +++----- templates/includes/header.php | 1 + templates/login-ldapmulti.php | 17 +++++---- templates/login.php | 17 +++++---- www/resources/default.css | 35 ++++++++++++++++++- 13 files changed, 99 insertions(+), 61 deletions(-) diff --git a/modules/core/hooks/hook_sanitycheck.php b/modules/core/hooks/hook_sanitycheck.php index 132e2ee26..d5b5084d7 100644 --- a/modules/core/hooks/hook_sanitycheck.php +++ b/modules/core/hooks/hook_sanitycheck.php @@ -26,7 +26,7 @@ function core_hook_sanitycheck(&$hookinfo) { if (version_compare(phpversion(), '5.2', '>=')) { $hookinfo['info'][] = '[core] You are running PHP version ' . phpversion() . '. Great.'; } elseif( version_compare(phpversion(), '5.1.2', '>=')) { - $hookinfo['info'][] = '[core] You are running PHP version ' . phpversion() . '. Its reccomended to upgrade to >= 5.2'; + $hookinfo['info'][] = '[core] You are running PHP version ' . phpversion() . '. It\'s recommended to upgrade to >= 5.2'; } else { $hookinfo['errors'][] = '[core] You are running PHP version ' . phpversion() . '. SimpleSAMLphp requires version >= 5.1.2, and reccomends version >= 5.2. Please upgrade!'; } diff --git a/modules/core/templates/frontpage_auth.tpl.php b/modules/core/templates/frontpage_auth.tpl.php index b5976246b..aa6037960 100644 --- a/modules/core/templates/frontpage_auth.tpl.php +++ b/modules/core/templates/frontpage_auth.tpl.php @@ -7,9 +7,9 @@ $this->includeAtTemplateBase('includes/header.php'); <?php if ($this->data['isadmin']) { - echo '<p class="float-r">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; + echo '<p class="float-r youareadmin">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; } else { - echo '<p class="float-r"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; + echo '<p class="float-r youareadmin"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; } ?> diff --git a/modules/core/templates/frontpage_config.tpl.php b/modules/core/templates/frontpage_config.tpl.php index 9fb3bf976..9b32275ea 100644 --- a/modules/core/templates/frontpage_config.tpl.php +++ b/modules/core/templates/frontpage_config.tpl.php @@ -15,9 +15,9 @@ $this->includeAtTemplateBase('includes/header.php'); </ul> --> <?php if ($this->data['isadmin']) { - echo '<p class="float-r">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; + echo '<p class="float-r youareadmin">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; } else { - echo '<p class="float-r"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; + echo '<p class="float-r youareadmin"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; } ?> diff --git a/modules/core/templates/frontpage_federation.tpl.php b/modules/core/templates/frontpage_federation.tpl.php index 3fe0b9eb3..afe93b08b 100644 --- a/modules/core/templates/frontpage_federation.tpl.php +++ b/modules/core/templates/frontpage_federation.tpl.php @@ -15,9 +15,9 @@ $this->includeAtTemplateBase('includes/header.php'); </ul> --> <?php if ($this->data['isadmin']) { - echo '<p class="float-r">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; + echo '<p class="float-r youareadmin">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; } else { - echo '<p class="float-r"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; + echo '<p class="float-r youareadmin"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; } ?> diff --git a/modules/core/templates/frontpage_welcome.tpl.php b/modules/core/templates/frontpage_welcome.tpl.php index dcde4f21b..6a145c099 100644 --- a/modules/core/templates/frontpage_welcome.tpl.php +++ b/modules/core/templates/frontpage_welcome.tpl.php @@ -8,9 +8,9 @@ $this->includeAtTemplateBase('includes/header.php'); <?php if ($this->data['isadmin']) { - echo '<p class="float-r">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; + echo '<p class="float-r youareadmin">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; } else { - echo '<p class="float-r"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; + echo '<p class="float-r youareadmin"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; } ?> diff --git a/modules/core/templates/loginuserpass.php b/modules/core/templates/loginuserpass.php index 35272a284..7b0cae6f9 100644 --- a/modules/core/templates/loginuserpass.php +++ b/modules/core/templates/loginuserpass.php @@ -14,7 +14,7 @@ $this->includeAtTemplateBase('includes/header.php'); if ($this->data['errorcode'] !== NULL) { ?> <div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5"> - <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" class="float-l" style="margin: 15px " /> + <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" class="float-l erroricon" style="margin: 15px " /> <h2><?php echo $this->t('{login:error_header}'); ?></h2> <p><b><?php echo htmlspecialchars($this->t('{errors:title_' . $this->data['errorcode'] . '}', $this->data['errorparams'])); ?></b></p> <p><?php echo htmlspecialchars($this->t('{errors:descr_' . $this->data['errorcode'] . '}', $this->data['errorparams'])); ?></p> @@ -24,12 +24,12 @@ if ($this->data['errorcode'] !== NULL) { ?> <h2 style="break: both"><?php echo $this->t('{login:user_pass_header}'); ?></h2> - <p><?php echo $this->t('{login:user_pass_text}'); ?></p> + <p class="logintext"><?php echo $this->t('{login:user_pass_text}'); ?></p> <form action="?" method="post" name="f"> <table> <tr> - <td rowspan="3"><img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-authentication.48x48.png" alt="" /></td> + <td rowspan="3"><img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-authentication.48x48.png" id="loginicon" alt="" /></td> <td style="padding: .3em;"><?php echo $this->t('{login:username}'); ?></td> <td> <?php @@ -59,7 +59,7 @@ if ($this->data['rememberUsernameEnabled']) { } else { $text = $this->t('{login:login_button}'); echo str_repeat("\t", 4); - echo "<input type=\"submit\" tabindex=\"4\" value=\"{$text}\" />"; + echo "<input type=\"submit\" tabindex=\"4\" id=\"regularsubmit\" value=\"{$text}\" />"; } ?> </td> @@ -73,7 +73,7 @@ if ($this->data['rememberUsernameEnabled']) { $rowspan = (array_key_exists('organizations', $this->data) ? 2 : 1); ?> <td style="padding: .4em;" rowspan="<?php echo $rowspan; ?>"> - <input type="submit" tabindex="5" value="<?php echo $this->t('{login:login_button}'); ?>" /> + <input type="submit" tabindex="5" id="regularsubmit" value="<?php echo $this->t('{login:login_button}'); ?>" /> </td> <?php } @@ -112,9 +112,10 @@ foreach ($this->data['organizations'] as $orgId => $orgDesc) { <?php } ?> - + <tr><td></td><td> + <input type="submit" tabindex="5" id="mobilesubmit" value="<?php echo $this->t('{login:login_button}'); ?>" /> + </td></tr> </table> - <?php foreach ($this->data['stateparams'] as $name => $value) { echo('<input type="hidden" name="' . htmlspecialchars($name) . '" value="' . htmlspecialchars($value) . '" />'); @@ -136,8 +137,8 @@ if(!empty($this->data['links'])) { -echo('<h2>' . $this->t('{login:help_header}') . '</h2>'); -echo('<p>' . $this->t('{login:help_text}') . '</p>'); +echo('<h2 class="logintext">' . $this->t('{login:help_header}') . '</h2>'); +echo('<p class="logintext">' . $this->t('{login:help_text}') . '</p>'); $this->includeAtTemplateBase('includes/footer.php'); -?> \ No newline at end of file +?> diff --git a/modules/saml/www/sp/metadata.php b/modules/saml/www/sp/metadata.php index b6e4681da..6a33ba04d 100644 --- a/modules/saml/www/sp/metadata.php +++ b/modules/saml/www/sp/metadata.php @@ -163,20 +163,23 @@ if ($orgName !== NULL) { } // add technical contact -$email = $config->getString('technicalcontact_email', NULL); -$contact = array('emailAddress' => $email); - -$name = $config->getString('technicalcontact_name', NULL); -if ($name === NULL) { - /* Nothing to do here... */ -} elseif (preg_match('@^(.*?)\s*,\s*(.*)$@D', $name, $matches)) { - $contact['surName'] = $matches[1]; - $contact['givenName'] = $matches[2]; -} elseif (preg_match('@^(.*?)\s+(.*)$@D', $name, $matches)) { - $contact['givenName'] = $matches[1]; - $contact['surName'] = $matches[2]; -} else { - $contact['givenName'] = $name; +$email = $config->getString('technicalcontact_email', 'na@example.org'); +if ( $email != 'na@example.org') { + + $contact = array('emailAddress' => $email); + + $name = $config->getString('technicalcontact_name', NULL); + if ($name === NULL) { + /* Nothing to do here... */ + } elseif (preg_match('@^(.*?)\s*,\s*(.*)$@D', $name, $matches)) { + $contact['surName'] = $matches[1]; + $contact['givenName'] = $matches[2]; + } elseif (preg_match('@^(.*?)\s+(.*)$@D', $name, $matches)) { + $contact['givenName'] = $matches[1]; + $contact['surName'] = $matches[2]; + } else { + $contact['givenName'] = $name; + } } // add certificate @@ -199,7 +202,7 @@ $metaArray20['entityid'] = $entityId; $metaBuilder = new SimpleSAML_Metadata_SAMLBuilder($entityId); $metaBuilder->addMetadataSP20($metaArray20, $supported_protocols); $metaBuilder->addOrganizationInfo($metaArray20); -$metaBuilder->addContact('technical', $contact); +if ( !empty($contact) ) $metaBuilder->addContact('technical', $contact); $xml = $metaBuilder->getEntityDescriptorText(); diff --git a/modules/sanitycheck/hooks/hook_sanitycheck.php b/modules/sanitycheck/hooks/hook_sanitycheck.php index 045b7f4f4..dbba1bec7 100644 --- a/modules/sanitycheck/hooks/hook_sanitycheck.php +++ b/modules/sanitycheck/hooks/hook_sanitycheck.php @@ -9,7 +9,7 @@ function sanitycheck_hook_sanitycheck(&$hookinfo) { assert('array_key_exists("errors", $hookinfo)'); assert('array_key_exists("info", $hookinfo)'); - $hookinfo['info'][] = '[sanitycheck] At least the sanity check it self is working :)'; + $hookinfo['info'][] = '[sanitycheck] At least the sanity check itself is working :)'; } -?> \ No newline at end of file +?> diff --git a/templates/includes/footer.php b/templates/includes/footer.php index 283749789..d48502934 100644 --- a/templates/includes/footer.php +++ b/templates/includes/footer.php @@ -1,18 +1,12 @@ <?php - - - if(!empty($this->data['htmlinject']['htmlContentPost'])) { foreach($this->data['htmlinject']['htmlContentPost'] AS $c) { echo $c; } } - - ?> - - - + </div><!-- #content --> + <div id="footer"> <hr /> <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/ssplogo-fish-small.png" alt="Small fish logo" style="float: right" /> @@ -20,9 +14,9 @@ if(!empty($this->data['htmlinject']['htmlContentPost'])) { <br style="clear: right" /> - </div><!-- #content --> + </div><!-- #footer --> </div><!-- #wrap --> </body> -</html> \ No newline at end of file +</html> diff --git a/templates/includes/header.php b/templates/includes/header.php index 4dd83e423..e83cc4566 100644 --- a/templates/includes/header.php +++ b/templates/includes/header.php @@ -43,6 +43,7 @@ header('X-Frame-Options: SAMEORIGIN'); <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, height=device-height, initial-scale=1.0" /> <script type="text/javascript" src="/<?php echo $this->data['baseurlpath']; ?>resources/script.js"></script> <title><?php if(array_key_exists('header', $this->data)) { diff --git a/templates/login-ldapmulti.php b/templates/login-ldapmulti.php index 61a01ab86..9e9ae971e 100644 --- a/templates/login-ldapmulti.php +++ b/templates/login-ldapmulti.php @@ -5,10 +5,10 @@ <?php if (isset($this->data['error'])) { ?> <div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5"> - <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" class="float-l" style="margin: 15px " /> + <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" class="float-l erroricon" style="margin: 15px " /> <h2><?php echo $this->t('error_header'); ?></h2> - <p><?php echo htmlspecialchars($this->data['error']); ?> </p> + <p class="logintext"><?php echo htmlspecialchars($this->data['error']); ?> </p> </div> <?php } ?> @@ -22,7 +22,7 @@ <table> <tr> - <td rowspan="3"><img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-authentication.48x48.png" /></td> + <td rowspan="3"><img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-authentication.48x48.png" id="loginicon" /></td> <td style="padding: .3em;"><?php echo $this->t('username'); ?></td> <td><input type="text" tabindex="1" name="username" <?php if (isset($this->data['username'])) { @@ -31,7 +31,7 @@ <td style="padding: .4em;" rowspan="3"> - <input type="submit" tabindex="3" value="Login" /> + <input type="submit" tabindex="3" id="regularsubmit" value="<?php echo $this->t('login_button'); ?>" /> <input type="hidden" name="RelayState" value="<?php echo htmlspecialchars($this->data['relaystate']); ?>" /> </td> </tr> @@ -55,17 +55,20 @@ <td style="padding: .3em;"><?php echo $this->t('password'); ?></td> <td><input type="password" tabindex="2" name="password" /></td> </tr> + <tr><td></td><td> + <input type="submit" tabindex="5" id="mobilesubmit" value="<?php echo $this->t('login_button'); ?>" /> + </td></tr> </table> </form> - <h2><?php echo $this->t('help_header'); ?>.</h2> + <h2 class="logintext"><?php echo $this->t('help_header'); ?>.</h2> - <p><?php echo $this->t('help_text'); ?>!</p> + <p class="logintext"><?php echo $this->t('help_text'); ?>!</p> -<?php $this->includeAtTemplateBase('includes/footer.php'); ?> \ No newline at end of file +<?php $this->includeAtTemplateBase('includes/footer.php'); ?> diff --git a/templates/login.php b/templates/login.php index a7081b721..6085b08c2 100644 --- a/templates/login.php +++ b/templates/login.php @@ -7,7 +7,7 @@ <?php if (isset($this->data['error'])) { ?> <div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5"> - <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" class="float-l" style="margin: 15px " /> + <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" class="float-l erroricon" style="margin: 15px" /> <h2><?php echo $this->t('error_header'); ?></h2> <p><?php echo $this->t($this->data['error']); ?> </p> @@ -16,13 +16,13 @@ <h2 style="break: both"><?php echo $this->t('user_pass_header'); ?></h2> - <p><?php echo $this->t('user_pass_text'); ?></p> + <p class="logintext"><?php echo $this->t('user_pass_text'); ?></p> <form action="?" method="post" name="f"> <table> <tr> - <td rowspan="2"><img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-authentication.48x48.png" /></td> + <td rowspan="2"><img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-authentication.48x48.png" id="loginicon" /></td> <td style="padding: .3em;"><?php echo $this->t('username'); ?></td> @@ -45,7 +45,7 @@ </td> <td style="padding: .4em;" rowspan="2"> - <input type="submit" tabindex="3" value="<?php echo $this->t('login_button'); ?>" /> + <input type="submit" class="regularsubmit" tabindex="3" value="<?php echo $this->t('login_button'); ?>" /> <input type="hidden" name="RelayState" value="<?php echo htmlspecialchars($this->data['relaystate']); ?>" /> </td> </tr> @@ -53,16 +53,19 @@ <td style="padding: .3em;"><?php echo $this->t('password'); ?></td> <td><input id="password" type="password" tabindex="2" name="password" /></td> </tr> + <tr><td></td><td> + <input type="submit" tabindex="5" id="mobilesubmit" value="<?php echo $this->t('{login_button}'); ?>" /> + </td></tr> </table> </form> - <h2><?php echo $this->t('help_header'); ?></h2> + <h2 class="logintext"><?php echo $this->t('help_header'); ?></h2> - <p><?php echo $this->t('help_text'); ?></p> + <p class="logintext"><?php echo $this->t('help_text'); ?></p> -<?php $this->includeAtTemplateBase('includes/footer.php'); ?> \ No newline at end of file +<?php $this->includeAtTemplateBase('includes/footer.php'); ?> diff --git a/www/resources/default.css b/www/resources/default.css index 958a86f70..2d2584112 100644 --- a/www/resources/default.css +++ b/www/resources/default.css @@ -119,7 +119,7 @@ dt { } -#content { +#content, #footer { padding: 0 20px; } @@ -348,4 +348,37 @@ caption { .float-l { float: left; } +#mobilesubmit { + display: none; +} +@media handheld, only screen and (max-width: 480px), only screen and (max-device-width: 480px) { + #header, #languagebar, #footer, .erroricon, #loginicon, .logintext, #regularsubmit { + display: none; + } + body { + font-size: 20px; + } + #wrap { + margin: 0; + } + h1,h2,h3,h4 { + font-size: 110%; + } + + #content { + margin-bottom: 10px; + padding: 0; + padding-left: 5px; + } + input[type="text"], input[type="password"] { + height: 1.5em; + font-size: 1em; + } + #mobilesubmit { + display: inline; + } + .youareadmin { + font-size: 50%; + } +} -- GitLab