Ejemplo n.º 1
0
 /** @test */
 public function it_is_a_correct_object()
 {
     $field = new Reset('test', 'Test');
     $this->assertSame('reset', $field->getOption('type'));
     $this->assertSame('administr/form::submit', $field->getView());
     $this->assertInstanceOf(AbstractType::class, $field);
 }
Ejemplo n.º 2
0
<?php

require_once 'core/init.php';
logged_in_redirect();
include 'includes/header.php';
?>

	<?php 
if (isset($_GET['alert']) && empty(Input::get('alert'))) {
    echo '<div class="callout alert">
					  <p>The link you\'re trying to access has already expired!</p>
				  </div>';
} else {
    if (isset($_GET['email']) && isset($_GET['password_token'])) {
        $reset = new Reset($_GET);
        $reset->fetchData();
        if (Input::get('password_token') !== $reset->data()->password_token) {
            Redirect::to('reset_password.php?alert');
        } else {
            if (Input::exists()) {
                if (Token::check(Input::get('token'))) {
                    $validate = new Validation();
                    $validation = $validate->check($_POST, array('password' => array('required' => true, 'min' => 6), 'password_again' => array('required' => true, 'matches' => 'password')));
                    if ($validation->passed()) {
                        $salt = Hash::salt(32);
                        $password = Input::get('password');
                        $reset->resetPassword($password, $salt);
                        Session::flash('login', 'Your password was successfully reset!');
                        Redirect::to('login.php');
                    }
                }
    {
        if ($password == '' || $passcode == '') {
            $data = "missing parameters";
            $this->display($data);
            exit;
        }
    }
    public function changePassword($password, $user_id, $passcode)
    {
        $this->parameterCheck($password, $passcode);
        //echo $rand;
        $count = $this->verifyPasscode($passcode, $user_id);
        if ($count == 0) {
            $data = "Incorrect passcode";
        } else {
            $this->setCryptMethod('sha1');
            $rand = $this->setCrypt($password);
            $query = CLS_MYSQL::Execute("UPDATE users SET user_pass='******',user_active='0' WHERE user_active='{$passcode}'");
            $data = "Password changed";
        }
        $this->display($data);
    }
    public function verifyPasscode($passcode, $user_id)
    {
        $query = CLS_MYSQL::Query("SELECT user_name FROM users WHERE user_active='{$passcode}' and user_id='{$user_id}'");
        $count = CLS_MYSQL::GetResultNumber($query);
        return $count;
    }
}
$reset = new Reset();
$reset->changePassword($password, $user_id, $passcode);