<commit_before><?php /* vim: set colorcolumn= expandtab shiftwidth=2 softtabstop=2 tabstop=4 smarttab: */
namespace BNETDocs\Templates\User;
use \CarlBennett\MVC\Libraries\Common;
use \CarlBennett\MVC\Libraries\Pair;
$title = 'Change Password';
$description = 'This form allows an individual to change the password to their account.';
$this->opengraph->attach(new Pair('url', '/user/changepassword'));
$error = $this->getContext()->error;
switch ($error)
{
  case 'NOT_LOGGED_IN': $message = 'You were not logged in to begin with.'; break;
  case 'NONMATCHING_PASSWORD': $message = 'The new password does not match its confirmation.'; break;
  case 'PASSWORD_CONTAINS_EMAIL': $message = 'The password contains the email address, use a better password.'; break;
  case 'PASSWORD_CONTAINS_USERNAME': $message = 'The password contains the username, use a better password.'; break;
  case 'PASSWORD_INCORRECT': $message = 'You did not enter your correct current password.'; break;
  case 'PASSWORD_TOO_LONG': $message = 'The password is too long, shorten it.'; break;
  case 'PASSWORD_TOO_SHORT': $message = 'The password is too short, use a better password.'; break;
  case 'PASSWORD_BLACKLIST': $message = $this->getContext()->error_extra; if (empty($message)) $message = 'The new password is blacklisted.'; break;
  case 'INTERNAL_ERROR': $message = 'An internal error occurred while processing your request. Our staff have been notified of the issue. Try again later.'; break;
  default: $message = $error;
}
require('./header.inc.phtml'); ?>
<div class="container mb-3">
  <div class="card mx-auto mb-3" style="width:18rem;">
    <h3 class="card-header text-lg-center"><?=$title?></h3>
    <div class="card-body">
<?  if ($error !== false) { ?>
<?    if (!empty($message)) { ?>
      <div class="alert alert-danger">
        <p class="mb-0"><?=$message?></p>
      </div>
<?    } ?>
      <form method="POST" action="?">
        <div class="form-group">
          <label class="form-input-label" for="pw1">Current password:</label>
          <input class="form-control border border-secondary bg-dark text-light" type="password" name="pw1" id="pw1" tabindex="1" value="" required autofocus="autofocus"/>
        </div>
        <div class="form-group">
          <label class="form-input-label" for="pw2">New password:</label><br/>
          <input class="form-control border border-secondary bg-dark text-light" type="password" name="pw2" id="pw2" tabindex="2" value="" required/>
        </div>
        <div class="form-group">
          <label class="form-input-label"  for="pw3">Confirm password:</label><br/>
          <input class="form-control border border-secondary bg-dark text-light"  type="password" name="pw3" id="pw3" tabindex="3" value="" required/>
        </div>
        <div class="form-group text-center">
          <hr class="border-secondary w-25"/>
          <input class="btn btn-success" type="submit" value="Change Password" tabindex="4"/>
        </div>
      </form>
<?    } else { ?>
      <div class="alert alert-success">
        <h4 class="alert-header">Password Changed</h4>
        <p class="mb-0">You have successfully changed your password!</p>
      </div>
<?  } ?><commit_msg>Add emoji to title<commit_after><?php /* vim: set colorcolumn= expandtab shiftwidth=2 softtabstop=2 tabstop=4 smarttab: */
namespace BNETDocs\Templates\User;
use \CarlBennett\MVC\Libraries\Common;
use \CarlBennett\MVC\Libraries\Pair;
$title = '🔑 Change Password';
$description = 'This form allows an individual to change the password to their account.';
$this->opengraph->attach(new Pair('url', '/user/changepassword'));
$error = $this->getContext()->error;
switch ($error)
{
  case 'NOT_LOGGED_IN': $message = 'You were not logged in to begin with.'; break;
  case 'NONMATCHING_PASSWORD': $message = 'The new password does not match its confirmation.'; break;
  case 'PASSWORD_CONTAINS_EMAIL': $message = 'The password contains the email address, use a better password.'; break;
  case 'PASSWORD_CONTAINS_USERNAME': $message = 'The password contains the username, use a better password.'; break;
  case 'PASSWORD_INCORRECT': $message = 'You did not enter your correct current password.'; break;
  case 'PASSWORD_TOO_LONG': $message = 'The password is too long, shorten it.'; break;
  case 'PASSWORD_TOO_SHORT': $message = 'The password is too short, use a better password.'; break;
  case 'PASSWORD_BLACKLIST': $message = $this->getContext()->error_extra; if (empty($message)) $message = 'The new password is blacklisted.'; break;
  case 'INTERNAL_ERROR': $message = 'An internal error occurred while processing your request. Our staff have been notified of the issue. Try again later.'; break;
  default: $message = $error;
}
require('./header.inc.phtml'); ?>
<div class="container mb-3">
  <div class="card mx-auto mb-3" style="width:18rem;">
    <h4 class="card-header text-center"><?=$title?></h4>
    <div class="card-body">
<?  if ($error !== false) { ?>
<?    if (!empty($message)) { ?>
      <div class="alert alert-danger">
        <p class="mb-0"><?=$message?></p>
      </div>
<?    } ?>
      <form method="POST" action="?">
        <div class="form-group">
          <label class="form-input-label" for="pw1">Current password:</label>
          <input class="form-control border border-secondary bg-dark text-light" type="password" name="pw1" id="pw1" tabindex="1" value="" required autofocus="autofocus"/>
        </div>
        <div class="form-group">
          <label class="form-input-label" for="pw2">New password:</label><br/>
          <input class="form-control border border-secondary bg-dark text-light" type="password" name="pw2" id="pw2" tabindex="2" value="" required/>
        </div>
        <div class="form-group">
          <label class="form-input-label"  for="pw3">Confirm password:</label><br/>
          <input class="form-control border border-secondary bg-dark text-light"  type="password" name="pw3" id="pw3" tabindex="3" value="" required/>
        </div>
        <div class="form-group text-center">
          <hr class="border-secondary w-25"/>
          <input class="btn btn-success" type="submit" value="Change Password" tabindex="4"/>
        </div>
      </form>
<?    } else { ?>
      <div class="alert alert-success">
        <h4 class="alert-header">Password Changed</h4>
        <p class="mb-0">You have successfully changed your password!</p>
      </div>
<?  } ?>
{'fraction_non_alphanumeric': 0.16423017107309487, 'fraction_numerical': 0.008709175738724729, 'mean_word_length': 3.879362670713202, 'pattern_counts': {'":': 0, '<': 95, '<?xml version=': 0, '>': 107, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1546151', 'n_tokens_mistral': 1969, 'n_tokens_neox': 1958, 'n_words': 564}