Skip to content
Snippets Groups Projects
Commit dbb77c46 authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Fix authYubiKey: old templates didn't work, autofocus failed on Twig

parent b026cf48
No related branches found
No related tags found
No related merge requests found
<?php
$this->data['header'] = $this->t('{authYubiKey:yubikey:header}');
$this->data['autofocus'] = 'otp';
$this->includeAtTemplateBase('includes/header.php');
?>
<?php
if ($this->data['errorcode'] !== NULL) {
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" alt="" />
......@@ -19,11 +17,11 @@ if ($this->data['errorcode'] !== NULL) {
}
?>
<img style="float: right" src="<?php echo($this->data['logo_url']); ?>" alt="" />
<img style="clear: right; float: right" src="<?php echo($this->data['devicepic_url']); ?>" alt="YubiKey" />
<img style="float: right" src="<?php echo($this->data['logoUrl']); ?>" alt="" />
<img style="clear: right; float: right" src="<?php echo($this->data['devicepicUrl']); ?>" alt="YubiKey" />
<h2 style=""><?php echo $this->t('{authYubiKey:yubikey:header}'); ?></h2>
<h2 style=""><?php echo $this->data['header']; ?></h2>
<form action="?" method="post" name="f">
......@@ -35,8 +33,8 @@ if ($this->data['errorcode'] !== NULL) {
<?php
foreach ($this->data['stateparams'] as $name => $value) {
echo('<input type="hidden" name="' . htmlspecialchars($name) . '" value="' . htmlspecialchars($value) . '" />');
foreach ($this->data['stateParams'] as $name => $value) {
echo '<input type="hidden" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" />';
}
?>
......
{% set pagetitle = '{authYubiKey:yubikey:header}'|trans %}
{% set pagetitle = header|trans %}
{% extends "base.twig" %}
{% block preload %}
<link rel="stylesheet" type="text/css" href="{{ baseurlpath }}assets/css/yubikey.css" />
{% endblock %}
{% block postload %}
<script src="{{ baseurlpath }}assets/js/autofocus.js"></script>
{% endblock %}
{% block content %}
{% if errorCode != null %}
<div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5">
......@@ -17,7 +25,7 @@
<h2>{{ '{authYubiKey:yubikey:header}'|trans }}</h2>
<form action="?" method="post" name="f">
<p>{{ '{authYubiKey:yubikey:intro}'|trans }}</p>
<p><input id="otp" style="border: 1px solid #ccc; background: #eee; padding: .5em; font-size: medium; width: 70%; color: #aaa" type="text" tabindex="2" name="otp" /></p>
<p><input id="otp" type="text" tabindex="2" name="otp" /></p>
{% for key, value in stateParams %}
<input type="hidden" name="{{ key|escape('html') }}" value="{{ value|escape('html') }}"/>
{% endfor %}
......
input#otp {
border: 1px solid #ccc;
background: #eee; padding: .5em;
font-size: medium;
width: 70%;
color: #aaa;
}
SimpleSAML_focus('otp');
......@@ -12,9 +12,11 @@
if (!array_key_exists('AuthState', $_REQUEST)) {
throw new \SimpleSAML\Error\BadRequest('Missing AuthState parameter.');
}
$authStateId = $_REQUEST['AuthState'];
$globalConfig = \SimpleSAML\Configuration::getInstance();
$t = new \SimpleSAML\XHTML\Template($globalConfig, 'authYubiKey:yubikeylogin.php');
$translator = $t->getTranslator();
$errorCode = null;
if (array_key_exists('otp', $_REQUEST)) {
......@@ -25,8 +27,10 @@ if (array_key_exists('otp', $_REQUEST)) {
$t->data['errorDesc'] = $errorCodes['desc'][$errorCode];
}
$t->data['header'] = $translator->t('{authYubiKey:yubikey:header}');
$t->data['autofocus'] = 'otp';
$t->data['errorCode'] = $errorCode;
$t->data['stateParams'] = array('AuthState' => $_REQUEST['authStateId']);
$t->data['stateParams'] = array('AuthState' => $authStateId);
$t->data['logoUrl'] = \SimpleSAML\Module::getModuleURL('authYubiKey/resources/logo.jpg');
$t->data['devicepicUrl'] = \SimpleSAML\Module::getModuleURL('authYubiKey/resources/yubikey.jpg');
$t->show();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment