@@ -24,7 +24,7 @@ public static function login(FinTs $finTs): void
24
24
}
25
25
}
26
26
27
- public static function action (FinTs $ finTs , BaseAction $ action )
27
+ public static function action (FinTs $ finTs , BaseAction $ action ): void
28
28
{
29
29
$ finTs ->execute ($ action );
30
30
@@ -59,7 +59,7 @@ public static function action(FinTs $finTs, BaseAction $action)
59
59
*/
60
60
public static function handleStrongAuthentication (FinTs $ finTs , BaseAction $ action ): void
61
61
{
62
- if ($ finTs ->getSelectedTanMode ()?->isDecoupled()) {
62
+ if ($ finTs ->getSelectedTanMode ()?->isDecoupled() === true ) {
63
63
self ::handleDecoupled ($ finTs , $ action );
64
64
} else {
65
65
self ::handleTan ($ finTs , $ action );
@@ -79,13 +79,14 @@ protected static function handleTan(FinTs $finTs, BaseAction $action): void
79
79
if ($ tanRequest ?->getChallenge() !== null ) {
80
80
echo ' Instructions: ' . $ tanRequest ?->getChallenge();
81
81
}
82
+
82
83
echo "\n" ;
83
84
if ($ tanRequest ?->getTanMediumName() !== null ) {
84
85
echo 'Please use this device: ' . $ tanRequest ?->getTanMediumName() . "\n" ;
85
86
}
86
87
87
88
// Challenge Image for PhotoTan/ChipTan
88
- if ($ tanRequest ?->getChallengeHhdUc()) {
89
+ if ($ tanRequest ?->getChallengeHhdUc() instanceof \ Fhp \ Syntax \Bin ) {
89
90
try {
90
91
$ flicker = new TanRequestChallengeFlicker ($ tanRequest ?->getChallengeHhdUc());
91
92
echo 'There is a challenge flicker. ' . PHP_EOL ;
@@ -117,7 +118,7 @@ protected static function handleTan(FinTs $finTs, BaseAction $action): void
117
118
echo "Please enter the TAN: \n" ;
118
119
$ tan = trim (fgets (STDIN ));
119
120
120
- echo " Submitting TAN: $ tan\n" ;
121
+ echo sprintf ( ' Submitting TAN: %s%s ' , $ tan, PHP_EOL ) ;
121
122
$ finTs ->submitTan ($ action , $ tan );
122
123
}
123
124
@@ -135,6 +136,7 @@ protected static function handleDecoupled(FinTs $finTs, BaseAction $action): voi
135
136
if ($ tanRequest ?->getChallenge() !== null ) {
136
137
echo ' Instructions: ' . $ tanRequest ?->getChallenge();
137
138
}
139
+
138
140
echo "\n" ;
139
141
if ($ tanRequest ?->getTanMediumName() !== null ) {
140
142
echo 'Please check this device: ' . $ tanRequest ?->getTanMediumName() . "\n" ;
@@ -145,7 +147,7 @@ protected static function handleDecoupled(FinTs $finTs, BaseAction $action): voi
145
147
// browser). This PHP sample code just serves to show the *logic* of the polling. Alternatively, you can even do
146
148
// without polling entirely and just let the user confirm manually in all cases (i.e. only implement the `else`
147
149
// branch below).
148
- if ($ tanMode ?->allowsAutomatedPolling()) {
150
+ if ($ tanMode ?->allowsAutomatedPolling() === true ) {
149
151
echo "Polling server to detect when the decoupled authentication is complete. \n" ;
150
152
sleep ($ tanMode ?->getFirstDecoupledCheckDelaySeconds());
151
153
for ($ attempt = 0 ;
@@ -156,20 +158,24 @@ protected static function handleDecoupled(FinTs $finTs, BaseAction $action): voi
156
158
echo "Confirmed. \n" ;
157
159
return ;
158
160
}
161
+
159
162
echo "Still waiting... \n" ;
160
163
sleep ($ tanMode ?->getPeriodicDecoupledCheckDelaySeconds());
161
164
}
162
- throw new RuntimeException ("Not confirmed after $ attempt attempts, which is the limit. " );
165
+
166
+ throw new RuntimeException (sprintf ('Not confirmed after %d attempts, which is the limit. ' , $ attempt ));
163
167
}
164
168
165
- if ($ tanMode ?->allowsManualConfirmation()) {
169
+ if ($ tanMode ?->allowsManualConfirmation() === true ) {
166
170
do {
167
171
echo "Please type 'done' and hit Return when you've completed the authentication on the other device. \n" ;
168
172
while (trim (fgets (STDIN )) !== 'done ' ) {
169
173
echo "Try again. \n" ;
170
174
}
175
+
171
176
echo "Confirming that the action is done. \n" ;
172
177
} while (! $ finTs ->checkDecoupledSubmission ($ action ));
178
+
173
179
echo "Confirmed \n" ;
174
180
} else {
175
181
throw new AssertionError ('Server allows neither automated polling nor manual confirmation ' );
0 commit comments