function EmitChangePasswordBox() { global $q_UpdateDetails, $q_pw1, $q_pw2; $P = person_if_signed_on(); if (!$P) { return; } importparams(array('pw1', '/[^\\s]+/', '', null), array('pw2', '/[^\\s]+/', '', null), array('UpdateDetails', '/^.+$/', '', false)); $has_password = $P->has_password(); ?> <div class="box"> <div class="head"> <h3><?php echo $has_password ? _('Change your password') : _('Set a password'); ?> </h3> </div> <div class="body"> <?php if (!$q_UpdateDetails && !$has_password) { ?> <p>Setting up a password means you won't have to confirm your email address every time you want to manage your journalist list.</p> <?php } ?> <form name="setpassword" action="/alert" method="post"> <input type="hidden" name="UpdateDetails" value="1"> <?php $error = null; if ($q_UpdateDetails) { if (is_null($q_pw1) || is_null($q_pw2)) { $error = _("Please type your new password twice"); } elseif (strlen($q_pw1) < 5 || strlen($q_pw2) < 5) { $error = _('Your password must be at least 5 characters long'); } elseif ($q_pw1 != $q_pw2) { $error = _("Please type the same password twice"); } else { $P->password($q_pw1); db_commit(); print '<p class="infomessage">' . ($has_password ? _('Password successfully updated') : _('Password successfully set')) . '</p>'; $has_password = true; } } if (!is_null($error)) { print "<p class=\"errhint\">{$error}</p>"; } ?> <div class="field"> <label for="pw1">New password</label> <input type="password" name="pw1" id="pw1" size="15" /> </div> <div class="field"> <label for="pw2">and again...</label> <input type="password" name="pw2" id="pw2" size="15" /> </div> <input name="submit" type="submit" value="<?php echo _('Submit'); ?> "> </form> </div> <div class="foot"></div> </div> <?php }
<h2>Sorry! Something's gone wrong.</h2> <em><?php echo $message; ?> </em> <!-- <?php echo "{$file}:{$line}"; ?> --> <?php page_footer(); } err_set_handler_display('jl_handle_error'); EnsureCookiesEnabled(); /* Get all the parameters which we might use (pulls them into $q_ prefixed vars) */ importparams(array('stash', '/^[0-9a-f]+$/', '', null), array('email', '/./', '', null), array(array('name', true), '//', '', null), array('password', '/[^\\s]/', '', null), array('t', '/^.+$/', '', null), array('rememberme', '/./', '', false)); /* General purpose login, asks for email also. */ if (0) { // CRUFT??? if (get_http_var("now")) { $P = person_signon(array('reason_web' => "Log in", 'reason_email' => "Log in to Journalisted", 'reason_email_subject' => 'Log in to Journalisted')); // account management page header("Location: /account"); exit; } } /* is there a token? (i.e. user coming in via a confirmation email) */ if (!is_null($q_t)) { $q_t = preg_replace('#</a$#', '', $q_t); /* Process emailed token */ $d = auth_token_retrieve('login', $q_t);