/ views / signin.tpl.php
signin.tpl.php
 1  <!DOCTYPE html>
 2  <html>
 3  <head>
 4    <meta charset="utf-8">
 5    <title>4chan - Email Verification</title>
 6    <meta name="viewport" content="width=device-width,initial-scale=1">
 7    <meta name="robots" content="noindex">
 8    <meta http-equiv="Accept-CH" content="Sec-CH-UA-Model">
 9  <?php if ($this->mode === 'index'): ?>
10    <?php if (self::CAPTCHA_MODE === 2): ?>
11    <script src="https://hcaptcha.com/1/api.js" async defer></script>
12    <?php else: ?>
13    <script src="https://www.google.com/recaptcha/api.js" async defer></script>
14    <?php endif ?>
15  <?php elseif ($this->mode === 'verify'): ?>
16    <?php if ($this->use_recaptcha): ?>
17    <script src="https://www.google.com/recaptcha/api.js" async defer></script>
18    <?php else: ?>
19    <script src="https://s.4cdn.org/js/tcaptcha.js"></script>
20    <style type="text/css">
21      #t-root {
22        background-color: #eee;
23        overflow: hidden;
24        margin-bottom: 3px;
25        box-shadow: 0 0 4px rgba(0, 0, 0, 0.25);
26        padding: 4px;
27        border-radius: 6px;
28      }
29    </style>
30    <?php endif ?>
31  <?php endif ?>
32    <link rel="stylesheet" type="text/css" href="//s.4cdn.org/css/signin.css">
33    <link rel="shortcut icon" href="//s.4cdn.org/image/favicon.ico" type="image/x-icon">
34  </head>
35  <body>
36  <header>
37    <img id="logo" alt="4chan" src="//s.4cdn.org/image/fp/minileaf-transparent.png" width="46" height="47">
38  </header>
39  <div id="content">
40  <?php if ($this->mode === 'index'): ?>
41  <?php if ($this->authed): ?>
42  <div class="protip"><p>This session is already verified.</p><p>You can clear your verified status by clicking the <i>Logout</i> button below.</p></div>
43  <form id="logout-form" action="" method="POST">
44    <button>Logout</button>
45    <input type="hidden" name="<?php echo self::CSRF_ARG ?>" value="<?php echo $this->csrf_token ?>">
46    <input type="hidden" name="action" value="signout">
47  </form>
48  <?php elseif ($this->pass_user): ?>
49  <h3 class="msg-success"><?php echo self::ERR_PASS_USER ?></h3>
50  <?php else: ?>
51  <h1 id="title">Email Verification</h1>
52  <div class="protip"><p>A verified email address may be used to bypass<br>anti-spam filters on some boards. If you are having trouble posting, try verifying your email.</p><p>Enter your email below and click <i>Send</i> to receive a verification link.</p><p>Your email address will be stored on our servers only briefly (usually for just a couple of minutes while the verification link is awaiting delivery).</p><p>Email verification is not required for <a href="https://www.4chan.org/pass">4chan Pass</a> users.</p></div>
53  <form id="auth-form" action="" method="POST">
54    <div class="form-line"><div class="g-recaptcha" data-sitekey="<?php echo self::CAPTCHA_MODE === 2 ? HCAPTCHA_API_KEY_PUBLIC : RECAPTCHA_API_KEY_PUBLIC ?>"></div></div>
55    <div class="form-line"><label for="email">Email</label><input id="email" <?php if (self::VERIFY_EMAIL_DOMAIN) { echo('pattern="[^@+]+@(' . implode('|', self::$allowed_domains) . ')"'); } ?> name="email" type="email" required><button>Send</button></div>
56    <?php if (self::VERIFY_EMAIL_DOMAIN): ?><div class="form-line domain-list"><b>Allowed domains are:</b> <?php echo implode(', ', self::$allowed_domains) ?></div><?php endif; ?>
57    <input type="hidden" name="<?php echo self::CSRF_ARG ?>" value="<?php echo $this->csrf_token ?>">
58    <input type="hidden" name="action" value="request">
59  </form>
60  <?php endif ?>
61  <?php elseif ($this->mode === 'verify-captcha-failed'): ?>
62  <h3>You seem to have mistyped the CAPTCHA.</h3>
63  <h4><a href="?action=verify&amp;tkn=<?php echo htmlspecialchars($this->token) ?>">Click here</a> to try again.</h4>
64  <?php elseif ($this->mode === 'verify'): ?>
65  <div class="protip"><p>Please solve the CAPTCHA to finish the verification.</p><p>Make sure cookies are not blocked before continuing.</p></div>
66  <form id="auth-form" action="<?php echo self::WEB_PATH ?>" method="POST">
67    <?php if (!$this->use_recaptcha): ?>
68    <div class="form-line"><div id="t-root"></div></div>
69    <script>
70      TCaptcha.init(document.getElementById('t-root'), '!signin', 1);
71      TCaptcha.onReloadClick();
72      window.addEventListener('pageshow', (e) => {
73        if (e.persisted) {
74          TCaptcha.clearChallenge();
75        }
76      });
77    </script>
78    <?php else: ?>
79    <div class="form-line"><div class="g-recaptcha" data-sitekey="<?php echo RECAPTCHA_API_KEY_PUBLIC ?>"></div></div>
80    <?php endif ?>
81    <button>Verify</button>
82    <input type="hidden" name="<?php echo self::CSRF_ARG ?>" value="<?php echo $this->csrf_token ?>">
83    <input type="hidden" name="action" value="verify">
84    <input type="hidden" name="tkn" value="<?php echo htmlspecialchars($this->token) ?>">
85  </form>
86  <?php elseif ($this->mode === 'verify-done'): ?>
87    <h3 class="msg-success">This session is now verified.</h3>
88  </div>
89  <?php elseif ($this->mode === 'request'): ?>
90    <h3 class="msg-success">An email containing the verification link will be sent out shortly.</h3>
91  <?php elseif ($this->mode === 'signout'): ?>
92    <h3 class="msg-success">Session cleared.</h3>
93  <?php elseif ($this->mode === 'error'): ?>
94    <h3 class="msg-error"><?php echo $this->msg ?></h3>
95  <?php endif ?>
96  </div>
97  <footer></footer>
98  </body>
99  </html>