|
1 | | -<?php |
2 | | - |
| 1 | +<?php /* vim: set colorcolumn= expandtab shiftwidth=2 softtabstop=2 tabstop=4 smarttab: */ |
3 | 2 | namespace BNETDocs\Templates\User; |
4 | | - |
5 | 3 | use \CarlBennett\MVC\Libraries\Common; |
6 | 4 | use \CarlBennett\MVC\Libraries\Pair; |
7 | | - |
8 | | -$title = 'Verify Account'; |
| 5 | +$title = 'Verify Account'; |
9 | 6 | $description = 'This form allows an individual to verify their account with a token.'; |
10 | 7 | $this->opengraph->attach( new Pair( 'url', '/user/verify' )); |
11 | | - |
12 | | -switch ( $this->getContext()->error ) { |
13 | | - case 'INVALID_TOKEN': |
14 | | - $message = 'The token is expired or invalid and therefore cannot be used.'; |
15 | | - break; |
16 | | - case 'INTERNAL_ERROR': |
17 | | - $message = 'An internal error occurred while processing your request. ' |
18 | | - . 'Our staff have been notified of the issue. Try again later.'; |
19 | | - break; |
20 | | - default: |
21 | | - $message = $this->getContext()->error; |
| 8 | +$error = $this->getContext()->error; |
| 9 | +switch ($error) |
| 10 | +{ |
| 11 | + case 'INVALID_TOKEN': $message = 'The token is expired or invalid and therefore cannot be used.'; break; |
| 12 | + case 'INTERNAL_ERROR': $message = 'An internal error occurred while processing your request. Our staff have been notified of the issue. Try again later.'; break; |
| 13 | + default: $message = $error; |
22 | 14 | } |
23 | | - |
24 | | -require('./header.inc.phtml'); |
25 | | -?> |
26 | | - <article> |
27 | | -<?php if ($this->getContext()->error !== false) { ?> |
28 | | - <header>Verify Account</header> |
29 | | -<?php if (!empty($message)) { ?> |
30 | | - <section class="red"> |
31 | | - <p><?php echo $message; ?></p> |
32 | | - </section> |
33 | | -<?php } ?> |
34 | | - <form method="GET" action="?"> |
35 | | - <section> |
36 | | - <label for="u">User Id:</label><br/> |
37 | | - <input |
38 | | - type="text" |
39 | | - name="u" |
40 | | - id="user_id" |
41 | | - value="<?php echo filter_var($this->getContext()->user_id, FILTER_SANITIZE_FULL_SPECIAL_CHARS); ?>" |
42 | | - tabindex="1" |
43 | | - required |
44 | | - /><br/> |
45 | | - <label for="t">Token:</label><br/> |
46 | | - <input |
47 | | - type="text" |
48 | | - name="t" |
49 | | - id="token" |
50 | | - value="<?php echo filter_var($this->getContext()->token, FILTER_SANITIZE_FULL_SPECIAL_CHARS); ?>" |
51 | | - tabindex="2" |
52 | | - required |
53 | | - autofocus="autofocus" |
54 | | - /> |
55 | | - </section> |
56 | | - <section> |
57 | | - <input |
58 | | - type="submit" |
59 | | - value="Verify Account" |
60 | | - tabindex="3" |
61 | | - /> |
62 | | - </section> |
63 | | - </form> |
64 | | -<?php } else { ?> |
65 | | - <header class="green">Account Verified</header> |
66 | | - <section class="green"> |
67 | | - <p>Your account has been verified successfully!</p> |
68 | | - <p>Use the navigation to the left to move to another page.</p> |
69 | | - </section> |
70 | | -<?php } ?> |
71 | | - </article> |
72 | | -<?php require('./footer.inc.phtml'); ?> |
| 15 | +$token = filter_var($this->getContext()->token, FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
| 16 | +$user_id = filter_var($this->getContext()->user_id, FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
| 17 | +require('./header.inc.phtml'); ?> |
| 18 | +<div class="container"> |
| 19 | +<? if ($this->getContext()->error !== false) { ?> |
| 20 | + <h1>Verify Account</h1> |
| 21 | +<? if (!empty($message)) { ?> |
| 22 | + <div class="alert alert-danger"> |
| 23 | + <p class="mb-0"><?=$message?></p> |
| 24 | + </div> |
| 25 | +<? } ?> |
| 26 | + <form method="GET" action="?"> |
| 27 | + <div class="form-group"> |
| 28 | + <label class="font-weight-bold" for="u">User Id:</label> |
| 29 | + <input class="bg-dark border border-primary form-control text-light" type="text" name="u" id="user_id" placeholder="Enter the user id here" value="<?=$user_id?>" tabindex="1" |
| 30 | + required |
| 31 | + /><br/> |
| 32 | + <div class="form-group"> |
| 33 | + </div> |
| 34 | + <label class="font-weight-bold" for="t">Token:</label> |
| 35 | + <input class="bg-dark border border-primary form-control text-light" type="text" name="t" id="token" placeholder="Enter the token here" value="<?=$token?>" tabindex="2" required autofocus="autofocus"/> |
| 36 | + </div> |
| 37 | + <div class="form-group"> |
| 38 | + <input class="btn btn-success" type="submit" value="Verify Account" tabindex="3"/> |
| 39 | + </div> |
| 40 | + </form> |
| 41 | +<? } else { ?> |
| 42 | + <h1 class="text-success">Account Verified</h1> |
| 43 | + <div class="alert alert-success"> |
| 44 | + <p class="mb-0">Your account has been verified successfully!</p> |
| 45 | + </div> |
| 46 | +<? } ?> |
| 47 | +</div> |
| 48 | +<? require('./footer.inc.phtml'); ?> |
0 commit comments