// Already logged in
 case 12:
     $utils->redirect($postloginurl);
     break;
 case 5:
     // Nothing tried yet
     // Process standard form actions
     switch ($form['action']) {
         case 'login':
             doLogin($form);
             break;
         case "register":
             registerNewUser();
             break;
         case "getsecurityquestion":
             $question = getSecurityQuestion($form['username']);
             if ($question === false) {
                 sendJSONError($lang['forgot_password_no_question']);
             } else {
                 sendJSONResponse(array("question" => $question));
             }
             break;
         case "fetchpassword":
             $form['answer'] = $utils->getRequestVar('answer');
             $form['answer'] = $db->escape($form['answer']);
             $answer = getPassword($form['username'], $form['answer']);
             if ($answer === false) {
                 sendJSONError($lang['forgot_password_invalid_answer']);
             } else {
                 sendJSONResponse(array("password" => $answer));
             }
Exemple #2
0
    <p>Tengase a bien responder la siguiente pregunta:</p>
    <?php 
        if ($error == true) {
            ?>
<span class="error">Debe responder en forma correcta para recibir la nueva contraseña.</span><?php 
        }
        ?>
    <form action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
" method="post">
		<ul id="UPDiv">
			<li>
        <label for="userLogin">Pregunta</label>
				<label for="userLogin"><div class="rhs"><?php 
        echo getSecurityQuestion($securityUser);
        ?>
</div></label>
			</li>
			<li><label for="userLogin">Respuesta</label>
			<div class="rhs"><input type="text" name="answer" id="answer" value="" maxlength="255"></div>
			</li>
			<li>
        <input type="hidden" name="subStep" value="2" />
        <input type="hidden" name="userID" value="<?php 
        echo $securityUser;
        ?>
" />
        <div class="rhs"><input type="submit" value="Submit" style="margin-left: 150px;" /></div>
        <div class="clear"></div>
			</li>
">					
					</form>
					
				
				<?php 
} elseif (isset($_POST['username'])) {
    ?>
				
					<form id="inputForm" data-user-type="Admin" action="passwordRecovery.php" method="post">
						<img class="admin_L" src="img/mowlogogreen.png" height=45px alt="Meals On Wheels Logo"><br>
						<img class="admin_L" src="img/mowdeliverygreen.png" height=35px alt="Delivery Logo"><br><br>
						<div>Password Recovery</div>
						<?php 
    $userName = $_POST['username'];
    // Get security question
    $question = getSecurityQuestion($userName);
    if ($question[0]) {
        $lable = "Answer";
        ?>
							<input type="hidden" value="<?php 
        echo $question[1];
        ?>
" id="uID" name="uID" >
							<input type="hidden" value="<?php 
        echo $question[2];
        ?>
" id="question" name="question" >							
							<label for="question"><?php 
        echo $question[2];
        ?>
</label><br>