Completed
Push — master ( efc296...9cc4ef )
by Stefan
18s queued 13s
created
templates/webauthn.tpl.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,21 +9,21 @@  discard block
 block discarded – undo
9 9
 
10 10
     <h1><?php echo htmlspecialchars($this->t('{webauthn:webauthn:heading1}')); ?></h1>
11 11
     <h2><?php echo htmlspecialchars($this->t('{webauthn:webauthn:accountEnabled}')); ?></h2>
12
-    <?php if((isset($this->data['FIDO2Tokens'])?((is_array($this->data['FIDO2Tokens']) || $this->data['FIDO2Tokens'] instanceof Countable)?count($this->data['FIDO2Tokens']):strlen($this->data['FIDO2Tokens'])):0) > 0): ?>
12
+    <?php if ((isset($this->data['FIDO2Tokens']) ? ((is_array($this->data['FIDO2Tokens']) || $this->data['FIDO2Tokens'] instanceof Countable) ?count($this->data['FIDO2Tokens']) : strlen($this->data['FIDO2Tokens'])) : 0) > 0) : ?>
13 13
         <div id="currentTokens">
14 14
             <span id='tokencaption'><?php echo htmlspecialchars($this->t('{webauthn:webauthn:tokenList}')); ?></span>
15 15
             <ul>
16
-                <?php foreach($this->data['FIDO2Tokens'] as $index => $this->data['token']): ?>
17
-                    <?php if($this->data['FIDO2AuthSuccessful'] == false or $this->data['FIDO2AuthSuccessful'] != $this->data['token'][0]): ?>
16
+                <?php foreach ($this->data['FIDO2Tokens'] as $index => $this->data['token']): ?>
17
+                    <?php if ($this->data['FIDO2AuthSuccessful'] == false or $this->data['FIDO2AuthSuccessful'] != $this->data['token'][0]): ?>
18 18
                         <li class='othertoken'><?php echo htmlspecialchars($this->data['token'][3]); ?></li>
19 19
                     <?php else: ?>
20 20
                         <li class='currenttoken'><?php echo htmlspecialchars($this->data['token'][3]); ?> <?php echo htmlspecialchars($this->t('{webauthn:webauthn:currentToken}')); ?></li>
21 21
                     <?php endif; ?>
22
-                <?php endforeach;?>
22
+                <?php endforeach; ?>
23 23
             </ul>
24 24
         </div>
25 25
     <?php endif; ?>
26
-    <?php if((isset($this->data['regURL'])?((is_array($this->data['regURL']) || $this->data['regURL'] instanceof Countable)?count($this->data['regURL']):strlen($this->data['regURL'])):0) > 0): ?>
26
+    <?php if ((isset($this->data['regURL']) ? ((is_array($this->data['regURL']) || $this->data['regURL'] instanceof Countable) ?count($this->data['regURL']) : strlen($this->data['regURL'])) : 0) > 0) : ?>
27 27
         <form id='regform' method='POST' action='<?php echo $this->data['regURL']; ?>'>
28 28
             <input type='hidden' id='resp' name='response_id' value='0'/>
29 29
             <input type='hidden' id='data' name='attestation_client_data_json' value='nix'/>
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
                 value='<?php echo htmlspecialchars($this->t('{webauthn:webauthn:newTokenDefaultName}')); ?> <?php echo htmlspecialchars((new DateTime("now"))->format('Y-m-d')); ?>' />
37 37
         </form>
38 38
         <div class='space'></div>
39
-        <?php if((isset($this->data['FIDO2Tokens'])?((is_array($this->data['FIDO2Tokens']) || $this->data['FIDO2Tokens'] instanceof Countable)?count($this->data['FIDO2Tokens']):strlen($this->data['FIDO2Tokens'])):0) > 0): ?>
40
-            <?php foreach($this->data['FIDO2Tokens'] as $index => $this->data['token']): ?>
41
-                <?php if($this->data['FIDO2AuthSuccessful'] != $this->data['token'][0]): ?>
39
+        <?php if ((isset($this->data['FIDO2Tokens']) ? ((is_array($this->data['FIDO2Tokens']) || $this->data['FIDO2Tokens'] instanceof Countable) ?count($this->data['FIDO2Tokens']) : strlen($this->data['FIDO2Tokens'])) : 0) > 0) : ?>
40
+            <?php foreach ($this->data['FIDO2Tokens'] as $index => $this->data['token']): ?>
41
+                <?php if ($this->data['FIDO2AuthSuccessful'] != $this->data['token'][0]): ?>
42 42
                     <form class='deleteform' id='delete-<?php echo htmlspecialchars($index); ?>' method='POST' action='<?php echo $this->data['delURL']; ?>'>
43 43
                         <input type='hidden' id='credId-<?php echo htmlspecialchars($index); ?>' name='credId' value='<?php echo htmlspecialchars($this->data['token'][0]); ?>'/>
44 44
                         <button type='submit' id='submit-<?php echo htmlspecialchars($index); ?>' name='submit' value='DELETE'>
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
                         </button>
47 47
                     </form>
48 48
                 <?php endif; ?>
49
-            <?php endforeach;?>
49
+            <?php endforeach; ?>
50 50
             <div class='space'></div>
51 51
             <form id='nevermind' method='POST' action='<?php echo $this->data['delURL']; ?>'>
52 52
                 <button type='submit' id='submit-nevermind' name='submit' value='NEVERMIND'>
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
             </form>
56 56
         <?php endif; ?>
57 57
     <?php endif; ?>
58
-    <?php if((isset($this->data['authURL'])?((is_array($this->data['authURL']) || $this->data['authURL'] instanceof Countable)?count($this->data['authURL']):strlen($this->data['authURL'])):0) > 0): ?>
58
+    <?php if ((isset($this->data['authURL']) ? ((is_array($this->data['authURL']) || $this->data['authURL'] instanceof Countable) ?count($this->data['authURL']) : strlen($this->data['authURL'])) : 0) > 0) : ?>
59 59
         <form id='authform' method='POST' action='<?php echo $this->data['authURL']; ?>'>
60 60
             <input type='hidden' id='resp' name='response_id' value='0'/>
61 61
             <input type='hidden' id='data_raw_b64' name='client_data_raw' value='garnix'/>
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             <input type='hidden' id='operation' name='operation' value='AUTH'/>
68 68
             <input type='checkbox' id='credentialChange' name='credentialChange'>
69 69
             <label for='credentialChange'>
70
-                <?php if((isset($this->data['FIDO2Tokens'])?((is_array($this->data['FIDO2Tokens']) || $this->data['FIDO2Tokens'] instanceof Countable)?count($this->data['FIDO2Tokens']):strlen($this->data['FIDO2Tokens'])):0) < 2): ?>
70
+                <?php if ((isset($this->data['FIDO2Tokens']) ? ((is_array($this->data['FIDO2Tokens']) || $this->data['FIDO2Tokens'] instanceof Countable) ?count($this->data['FIDO2Tokens']) : strlen($this->data['FIDO2Tokens'])) : 0) < 2) : ?>
71 71
                     <?php echo htmlspecialchars($this->t('{webauthn:webauthn:wantsAdd}')); ?>
72 72
                 <?php else: ?>
73 73
                     <?php echo htmlspecialchars($this->t('{webauthn:webauthn:wantsModification}')); ?>
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,8 +16,11 @@  discard block
 block discarded – undo
16 16
                 <?php foreach($this->data['FIDO2Tokens'] as $index => $this->data['token']): ?>
17 17
                     <?php if($this->data['FIDO2AuthSuccessful'] == false or $this->data['FIDO2AuthSuccessful'] != $this->data['token'][0]): ?>
18 18
                         <li class='othertoken'><?php echo htmlspecialchars($this->data['token'][3]); ?></li>
19
-                    <?php else: ?>
20
-                        <li class='currenttoken'><?php echo htmlspecialchars($this->data['token'][3]); ?> <?php echo htmlspecialchars($this->t('{webauthn:webauthn:currentToken}')); ?></li>
19
+                    <?php else {
20
+    : ?>
21
+                        <li class='currenttoken'><?php echo htmlspecialchars($this->data['token'][3]);
22
+}
23
+?> <?php echo htmlspecialchars($this->t('{webauthn:webauthn:currentToken}')); ?></li>
21 24
                     <?php endif; ?>
22 25
                 <?php endforeach;?>
23 26
             </ul>
@@ -69,8 +72,11 @@  discard block
 block discarded – undo
69 72
             <label for='credentialChange'>
70 73
                 <?php if((isset($this->data['FIDO2Tokens'])?((is_array($this->data['FIDO2Tokens']) || $this->data['FIDO2Tokens'] instanceof Countable)?count($this->data['FIDO2Tokens']):strlen($this->data['FIDO2Tokens'])):0) < 2): ?>
71 74
                     <?php echo htmlspecialchars($this->t('{webauthn:webauthn:wantsAdd}')); ?>
72
-                <?php else: ?>
73
-                    <?php echo htmlspecialchars($this->t('{webauthn:webauthn:wantsModification}')); ?>
75
+                <?php else {
76
+    : ?>
77
+                    <?php echo htmlspecialchars($this->t('{webauthn:webauthn:wantsModification}'));
78
+}
79
+?>
74 80
                 <?php endif; ?>
75 81
             </label><br/>
76 82
             <button type='button' id='authformSubmit'><?php echo htmlspecialchars($this->t('{webauthn:webauthn:authTokenButton}')); ?></button>
Please login to merge, or discard this patch.
www/managetoken.php 1 patch
Switch Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -29,28 +29,28 @@
 block discarded – undo
29 29
     throw new Exception("Attempt to access the token management page unauthenticated.");
30 30
 }
31 31
 switch ($_POST['submit']) {
32
-    case "NEVERMIND":
33
-        Auth\ProcessingChain::resumeProcessing($state);
34
-        break;
35
-    case "DELETE":
36
-        if ($state['FIDO2AuthSuccessful'] == $_POST['credId']) {
37
-            throw new Exception("Attempt to delete the currently used credential despite UI preventing this.");
38
-        }
39
-        $store = $state['webauthn:store'];
40
-        $store->deleteTokenData($_POST['credId']);
41
-        if (array_key_exists('Registration', $state)) {
42
-            foreach ($state['FIDO2Tokens'] as $key => $value) {
43
-                if ($state['FIDO2Tokens'][$key][0] == $_POST['credId']) {
44
-                    unset($state['FIDO2Tokens'][$key]);
45
-                    break;
46
-                }
32
+        case "NEVERMIND":
33
+            Auth\ProcessingChain::resumeProcessing($state);
34
+            break;
35
+        case "DELETE":
36
+            if ($state['FIDO2AuthSuccessful'] == $_POST['credId']) {
37
+                throw new Exception("Attempt to delete the currently used credential despite UI preventing this.");
47 38
             }
39
+            $store = $state['webauthn:store'];
40
+            $store->deleteTokenData($_POST['credId']);
41
+            if (array_key_exists('Registration', $state)) {
42
+                foreach ($state['FIDO2Tokens'] as $key => $value) {
43
+                    if ($state['FIDO2Tokens'][$key][0] == $_POST['credId']) {
44
+                        unset($state['FIDO2Tokens'][$key]);
45
+                        break;
46
+                    }
47
+                }
48 48
 
49
-            StaticProcessHelper::saveStateAndRedirect($state);
50
-        } else {
51
-            Auth\ProcessingChain::resumeProcessing($state);
52
-        }
53
-        break;
54
-    default:
55
-        throw new Exception("Unknown submit button state.");
49
+                StaticProcessHelper::saveStateAndRedirect($state);
50
+            } else {
51
+                Auth\ProcessingChain::resumeProcessing($state);
52
+            }
53
+            break;
54
+        default:
55
+            throw new Exception("Unknown submit button state.");
56 56
 }
Please login to merge, or discard this patch.
www/webauthn.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
 $frontendData = [];
68 68
 $frontendData['challengeEncoded'] = $challengeEncoded;
69 69
 $frontendData['state'] = [];
70
-foreach (['Source', 'FIDO2Scope','FIDO2Username','FIDO2Displayname','requestTokenModel'] as $stateItem) {
70
+foreach (['Source', 'FIDO2Scope', 'FIDO2Username', 'FIDO2Displayname', 'requestTokenModel'] as $stateItem) {
71 71
     $frontendData['state'][$stateItem] = $state[$stateItem];
72 72
 }
73 73
 
Please login to merge, or discard this patch.