Exemplo n.º 1
0
        $dbc->confirm();
    }
    if (!empty($new_user->user_id)) {
        //Assign basic role
        $user_role = new user_role();
        $user_role->user_id = $new_user->user_id;
        $user_role->role_code = 'BASIC';
        $user_role->save();
        $dbc->confirm();
        $msg .= '<div class="message error"> Account is Successfully created!. Please check your mail box for further details. </div>';
    } else {
        $msg .= '<div class="message error"> Account creation failed!. Contact the admin. </div>';
    }
}
if (!empty($_POST['resetPassword'])) {
    $pr = new user_password_reset();
    $ru = new user();
    if (!empty($_POST['username'][0])) {
        $username = $_POST['username'][0];
        $resetUser = $ru->findBy_userName($username);
    } elseif (!empty($_POST['email'][0])) {
        $email = $_POST['email'][0];
        $resetUser = $ru->findBy_eMail($email);
    } else {
        $msg .= '<div class="error"> No record found! Check the entered user name or email. </div>';
    }
    if (!empty($resetUser)) {
        $result_msg = $pr->generateResetPassword($resetUser);
        $msg .= '<div class="error">' . $result_msg . ' A new pasword reset link has been set to the registered email address </div>';
    }
}
Exemplo n.º 2
0
<?php 
if ($session->login_status()) {
    redirect_to(HOME_URL);
}
global $dbc;
$upr = new user_password_reset();
if (!empty($_GET['user_id']) && $_GET['code']) {
    $user_id = trim(mysql_prep($_GET['user_id']));
    $code = trim(mysql_prep($_GET['code']));
    $unused_code = $upr->findBy_userId($user_id);
    if ($unused_code->code == $code) {
        $loggedin_user = user::find_by_id($unused_code->user_id);
        $session->login($loggedin_user);
        $session->assign_role($_SESSION['user_id']);
        //update unused record to used record
        $new_password_request = new user_password_reset();
        $new_password_request->user_password_reset_id = $unused_code->user_password_reset_id;
        $new_password_request->status = 1;
        $new_password_request->save();
        $dbc->confirm();
    }
    if (!empty($loggedin_user)) {
        $session->login($loggedin_user);
        $session->assign_role($_SESSION['user_id']);
        redirect_to(HOME_URL . "form.php?class_name=user&mode=9&user_id=34?user_id=" . $_SESSION['user_id']);
    } else {
        echo " Invalid link. Reset password again";
        //        echo "Actual password is ".$login_status;
    }
    //en of if else
} else {