Exemplo n.º 1
0
                        </td>
                    </tr>
                </table>
            </form>
        </div>
        <?php 
        require 'footer.php';
        die;
    } else {
        Gadget::redirect('index');
        die;
    }
} elseif (isset($_REQUEST['submit_new_pass'])) {
    // Insert new password and set expires to 0
    $request = dbi()->q_1("SELECT * FROM password_reset_requests WHERE token_id = '" . $_SESSION['token_id'] . "'");
    dbi()->update('Customers', array('Password' => Access::create_hash($_REQUEST['new_pass'], 'strong')), 'CustomerID = ' . $request->CustomerID);
    dbi()->update('password_reset_requests', array('expires' => '0000-00-00 00:00:00'), 'token_id = \'' . $_SESSION['token_id'] . '\'');
    unset($_SESSION['token_id']);
    Gadget::add_message('Your password has been reset!');
    Gadget::redirect('login');
    die;
}
require 'header.php';
?>
<div class="content-padding">
    <form name="forgot-form" class="user-form" id="forgot-form" action="forgot" method="post">
        <table>
            <tr>
                <td>
                    <label for="forgot-email">email:</label>
                </td>
Exemplo n.º 2
0
 public function set_password($new_pass)
 {
     $this->Password = Access::create_hash($new_pass, 'strong');
     $this->update();
 }
Exemplo n.º 3
0
            'one_of'   => array($password),
        ),
        array(
            'name'     => 'Zip',
            'value'    => $zip,
            'required' => true,
            'match'    => '/^[0-9]{5}$/',
        ),
    ));

    if($validation->errors){
        Gadget::add_message($validation->get_errors());
    }else{
        $insert_data = array(
            'Email'    => $email,
            'Password' => Access::create_hash($password, 'strong'),
            'DeliveryZip' => $zip
        );
        $dbi->insert('Customers', $insert_data);
        if($dbi->errno == 1062){
            Gadget::add_message('This email address is already registered.');
        }else{
            Gadget::add_message('Your account has been created.');
            Gadget::redirect('login');
        }
    }
}

require 'header.php';
?>
<div class="content-padding">
Exemplo n.º 4
0
                        echo json_encode(array('result' => true, 'msg' => 'Successfully Logged In', 'extra' => json_encode($customer)));
                        break;
                    case 1:
                        echo json_encode(array('result' => false, 'msg' => "Incorrect Password"));
                        break;
                    case 2:
                        echo json_encode(array('result' => false, 'msg' => "Invalid Email"));
                        break;
                }
            } else {
                echo json_encode(array('result' => false, 'msg' => "Invalid username or password."));
            }
            break;
        case 'register':
            if (isset($_REQUEST['user']) && isset($_REQUEST['pass'])) {
                $insert_data = array('Email' => $_REQUEST['user'], 'Password' => Access::create_hash($_REQUEST['pass'], 'strong'));
                $dbi->insert('Customers', $insert_data);
                Access::log_user_in_ajax($_REQUEST['user'], $_REQUEST['pass']);
                echo json_encode(array('result' => true, 'msg' => "Your account has been created", 'extra' => Customer::get_current()));
            } else {
                echo json_encode(array('result' => false, 'msg' => "Invalid email or password"));
            }
            break;
        default:
            $_SESSION['loggedin'] = false;
            echo json_encode(array('result' => false, 'code' => '1', 'msg' => "Requested action not defined"));
            break;
    }
} else {
    echo json_encode(array('result' => false, 'msg' => "Error: No action was defined."));
}
Exemplo n.º 5
0
require 'includes/global.inc.php';
debug(0, 0, 0);
$page = Page::get_from_alias('register');
$page->add_js('js/register.js');
if ($_POST) {
    $email = strtolower(trim($_POST['register-email']));
    $password = $_POST['register-password'];
    $password2 = $_POST['confirm-password'];
    $zip = $_POST['register-zip'];
    $validation = new Validation();
    $validation->validate_array(array(array('name' => 'Email', 'value' => $email, 'match' => '/^[A-Z0-9._%+-]+\\@[A-Z0-9.-]+\\.[A-Z]{2,4}(\\.[A-Z]{2,4})?$/i', 'required' => true), array('name' => 'Password', 'value' => $password, 'required' => true), array('name' => 'Password Confirmation', 'value' => $password2, 'required' => true, 'one_of' => array($password)), array('name' => 'Zip', 'value' => $zip, 'required' => true, 'match' => '/^[0-9]{5}$/')));
    if ($validation->errors) {
        Gadget::add_message($validation->get_errors());
    } else {
        $insert_data = array('Email' => $email, 'Password' => Access::create_hash($password, 'strong'), 'DeliveryZip' => $zip);
        $dbi->insert('Customers', $insert_data);
        if ($dbi->errno == 1062) {
            Gadget::add_message('This email address is already registered.');
        } else {
            Gadget::add_message('Your account has been created.');
            Gadget::redirect('login');
        }
    }
}
require 'header.php';
?>
<div class="content-padding">
    <form class="user-form" name="register-form" id="register-form" action="register" method="post" onsubmit="return validateForm();">
        <table>
            <tr>