Skip to content

Commit 0341007

Browse files
committed
Updated demos
Check for settings.php Only ask for OTP or PIN if authMode is set to "explicit".
1 parent e389d01 commit 0341007

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

examples/demo.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313

1414
session_start();
1515

16+
if (!file_exists('settings.php')) {
17+
echo 'The settings.php file is missing. See settings.php.dist for an example.';
18+
die();
19+
}
20+
1621
$settings = require 'settings.php';
1722
$apiUri = $settings['apiUri'];
1823

@@ -60,10 +65,10 @@
6065
$module->setCertificate($certificate);
6166
$module->setExtraCertificates($certificates);
6267

63-
if (!isset($_GET['otp']) && !isset($_GET['pin'])) {
64-
echo 'No OTP nor PIN given.';
68+
if ($credentialInfo['authMode'] === 'explicit' && !isset($_GET['otp']) && !isset($_GET['pin'])) {
69+
// you should check the OTP and/or PIN entry in $credentialInfo for how to setup authentication exactly
70+
echo 'Please enter OTP or PIN:';
6571
echo '<form><input type="text" name="otp" placeholder="OTP"> or <input type="text" name="pin" placeholder="PIN">';
66-
echo ' or leave blank for implicit authorization.';
6772
echo '<input type="submit"/></form>';
6873
die();
6974
}

examples/ltv-demo.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313

1414
session_start();
1515

16+
if (!file_exists('settings.php')) {
17+
echo 'The settings.php file is missing. See settings.php.dist for an example.';
18+
die();
19+
}
20+
1621
$settings = require 'settings.php';
1722
$apiUri = $settings['apiUri'];
1823

@@ -82,10 +87,10 @@
8287
$module->addCrl($crl);
8388
}
8489

85-
if (!isset($_GET['otp']) && !isset($_GET['pin'])) {
86-
echo 'No OTP nor PIN given.';
90+
if ($credentialInfo['authMode'] === 'explicit' && !isset($_GET['otp']) && !isset($_GET['pin'])) {
91+
// you should check the OTP and/or PIN entry in $credentialInfo for how to setup authentication exactly
92+
echo 'Please enter OTP or PIN:';
8793
echo '<form><input type="text" name="otp" placeholder="OTP"> or <input type="text" name="pin" placeholder="PIN">';
88-
echo ' or leave blank for implicit authorization.';
8994
echo '<input type="submit"/></form>';
9095
die();
9196
}

0 commit comments

Comments
 (0)