register.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <?php /** @noinspection PhpVoidFunctionResultUsedInspection */
  2. /**
  3. * @var User $user
  4. * @var UserAddress $user_address
  5. * @var UserAddress $secondary_user_address
  6. */
  7. $newsletter_consent_checked = ($user->newsletter_consent) ? "checked" : "";
  8. ?>
  9. <div class="container mt-3 py-4">
  10. <h2><?=htmlspecialchars(__("Register"))?></h2>
  11. <p><?=htmlspecialchars(__("Become a tester and earn £10 per test which should last no longer than 8 minutes!"))?></p>
  12. <p>
  13. <?=sprintf(htmlspecialchars(__("If you want more information on our security policy, please call us on %s (mobile call rate).")), PHONE)?>
  14. </p>
  15. <hr />
  16. <form method="post">
  17. <div class="row">
  18. <div class="col-lg-8 offset-lg-2">
  19. <div class="row mb-1">
  20. <label class="col-sm-4 col-form-label" for="title"><?=htmlspecialchars(__("Title"))?></label>
  21. <div class="col-sm">
  22. <select class="form-control w-auto" name="title" id="title" required>
  23. <option value=""><?=htmlspecialchars(__("Select title"))?></option>
  24. <?php
  25. foreach(User::titles() as $value => $display) {
  26. $selected = ($user->title === $value) ? "selected" : "";
  27. ?>
  28. <option value="<?=htmlspecialchars($value)?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
  29. <?php
  30. }
  31. ?>
  32. </select>
  33. </div>
  34. </div>
  35. <div class="row mb-1">
  36. <label class="col-sm-4 col-form-label" for="first-name"><?=htmlspecialchars(__("First Name"))?></label>
  37. <div class="col-sm">
  38. <input class="form-control w-auto" type="text" name="first_name" id="first-name" placeholder="<?=htmlspecialchars(__("Enter first name"))?>" value="<?=htmlspecialchars($user->first_name)?>" required />
  39. </div>
  40. </div>
  41. <div class="row mb-1">
  42. <label class="col-sm-4 col-form-label" for="last-name"><?=htmlspecialchars(__("Last Name"))?></label>
  43. <div class="col-sm">
  44. <input class="form-control w-auto" type="text" name="last_name" id="last-name" placeholder="<?=htmlspecialchars(__("Enter last name"))?>" value="<?=htmlspecialchars($user->last_name)?>" required />
  45. </div>
  46. </div>
  47. <div class="row mb-1">
  48. <label class="col-sm-4 col-form-label" for="gender"><?=htmlspecialchars(__("Gender"))?></label>
  49. <div class="col-sm">
  50. <select class="form-control w-auto" name="gender" id="gender" required>
  51. <option value=""><?=htmlspecialchars(__("Select gender"))?></option>
  52. <?php
  53. foreach(User::genders() as $gender_name => $display) {
  54. $value = $gender_name[0];
  55. $selected = ($user->gender === $value) ? "selected" : "";
  56. ?>
  57. <option value="<?=htmlspecialchars($value)?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
  58. <?php
  59. }
  60. ?>
  61. </select>
  62. </div>
  63. </div>
  64. <div class="row mb-1">
  65. <label class="col-sm-4 col-form-label" for="email"><?=htmlspecialchars(__("Email Address"))?></label>
  66. <div class="col-sm">
  67. <input class="form-control" type="email" name="email" id="email" placeholder="<?=htmlspecialchars(__("Enter email address"))?>" value="<?=htmlspecialchars($user->email)?>" required />
  68. </div>
  69. </div>
  70. <div class="row mb-1">
  71. <label class="col-sm-4 col-form-label" for="phone"><?=htmlspecialchars(__("Mobile Number"))?></label>
  72. <div class="col-sm">
  73. <input class="form-control w-auto" type="tel" name="phone" id="phone" placeholder="<?=htmlspecialchars(__("Enter mobile number"))?>" value="<?=htmlspecialchars($user->phone)?>" required />
  74. </div>
  75. </div>
  76. <div class="row mb-1">
  77. <label class="col-sm-4 col-form-label" for="password"><?=htmlspecialchars(__("Password"))?></label>
  78. <div class="col-sm">
  79. <input class="form-control" type="password" name="password" id="password" placeholder="<?=htmlspecialchars(__("Enter password"))?>" autocomplete="new-password" required />
  80. <small class="text-muted form-text"><?=sprintf(htmlspecialchars(__("At least %s6 characters%s. Must contain at least one %slowercase%s, %suppercase%s, %snumber%s and %sspecial%s character.")),
  81. '<span data-length-requirement>', '</span>',
  82. '<span data-lowercase-requirement>', '</span>',
  83. '<span data-uppercase-requirement>', '</span>',
  84. '<span data-number-requirement>', '</span>',
  85. '<span data-special-requirement>', '</span>'
  86. )?></small>
  87. </div>
  88. </div>
  89. <div class="row mb-1">
  90. <label class="col-sm-4 col-form-label" for="password-confirm"><?=htmlspecialchars(__("Confirm Password"))?></label>
  91. <div class="col-sm">
  92. <input class="form-control" type="password" name="password_confirm" id="password-confirm" placeholder="<?=htmlspecialchars(__("Confirm password"))?>" autocomplete="new-password" required />
  93. </div>
  94. </div>
  95. <div class="row mb-1">
  96. <label class="col-sm-4 col-form-label" for="date-of-birth"><?=htmlspecialchars(__("Date of Birth"))?></label>
  97. <div class="col-sm">
  98. <input class="form-control" type="date" name="date_of_birth" id="date-of-birth" value="<?=htmlspecialchars($user->date_of_birth)?>" required />
  99. </div>
  100. </div>
  101. <div class="row mb-1">
  102. <label class="col-sm-4 col-form-label" for="postal-code"><?=htmlspecialchars(__("Postal Code"))?></label>
  103. <div class="col-sm">
  104. <input class="form-control w-auto" type="text" name="postal_code" id="postal-code" placeholder="<?=htmlspecialchars(__("Enter postal code"))?>" value="<?=htmlspecialchars($user_address->postal_code)?>" required />
  105. </div>
  106. </div>
  107. <div class="row mb-1">
  108. <label class="col-sm-4 col-form-label" for="secondary-postal-code"><?=htmlspecialchars(__("Secondary Postal Code"))?></label>
  109. <div class="col-sm">
  110. <input class="form-control w-auto" type="text" name="secondary_postal_code" id="secondary-postal-code" placeholder="<?=htmlspecialchars(__("Enter postal code"))?>" value="<?=htmlspecialchars($secondary_user_address->postal_code)?>" />
  111. </div>
  112. </div>
  113. <div class="row mb-3">
  114. <label class="col-sm-4 col-form-label" for="country"><?=htmlspecialchars(__("Country"))?></label>
  115. <div class="col-sm">
  116. <select class="form-control w-auto" name="country" id="country" required>
  117. <?=Form::renderCountryOptions($user_address->country)?>
  118. </select>
  119. </div>
  120. </div>
  121. <div class="row mb-1">
  122. <label class="col-sm-4 col-form-label" for="question"><?=htmlspecialchars(__("What day of the month is it?"))?></label>
  123. <div class="col-sm">
  124. <input class="form-control w-auto" type="text" name="question" id="question" placeholder="<?=htmlspecialchars(__("Enter answer"))?>" required />
  125. <small class="text-muted">
  126. <?=htmlspecialchars(__("If today is the 19th of August, enter: 19"))?>
  127. </small>
  128. </div>
  129. </div>
  130. <div class="row mb-1">
  131. <div class="col-sm offset-sm-4">
  132. <label>
  133. <input type="checkbox" value="1" name="has_driving_licence" /> <?=htmlspecialchars("I have a driving licence")?>
  134. </label>
  135. </div>
  136. </div>
  137. <div class="row mb-1">
  138. <div class="col-sm offset-sm-4">
  139. <label>
  140. <input type="checkbox" value="1" name="has_car" /> <?=htmlspecialchars("I have access to a car at either postal codes")?>
  141. </label>
  142. </div>
  143. </div>
  144. <div class="row mb-1">
  145. <div class="col-sm offset-sm-4">
  146. <label>
  147. <input type="checkbox" value="1" name="terms_accepted" /> <?=sprintf(htmlspecialchars(__("I agree to and have read the %sTerms and Conditions%s and %sPrivacy Policy%s")),
  148. '<a href="/terms-and-conditions" target="_blank">', '</a>',
  149. '<a href="/privacy-policy" target="_blank">', '</a>'
  150. )?>
  151. </label>
  152. </div>
  153. </div>
  154. <div class="row mb-1">
  155. <div class="col-sm offset-sm-4 align-self-center">
  156. <label><input type="checkbox" name="newsletter_content" id="newsletter-consent" value="1" <?=$newsletter_consent_checked?> /> <?=sprintf(htmlspecialchars(__("Opt-in to newsletters about %s")), APP_NAME)?></label>
  157. </div>
  158. </div>
  159. <div class="row">
  160. <div class="col-sm offset-sm-4">
  161. <?php
  162. if(GOOGLE_RECAPTCHA_SITE_KEY) {
  163. ?>
  164. <div class="g-recaptcha mb-1" data-sitekey="<?=GOOGLE_RECAPTCHA_SITE_KEY?>"></div>
  165. <?php
  166. }
  167. ?>
  168. <button class="btn btn-primary" type="submit" name="submit" value="<?=htmlspecialchars($_SESSION["csrf_token"])?>"><?=htmlspecialchars(__("Register"))?></button>
  169. </div>
  170. </div>
  171. </div>
  172. </div>
  173. </form>
  174. </div>