public function postUpdatepassword()
 {
     $data = Input::only('oldpass', 'newpass', 'email');
     $userObj = new User();
     $update = $userObj->updateUserPassword($data['email'], $data['oldpass'], $data['newpass']);
     if ($update) {
         return Response::json(array('status' => '1', $data));
     } else {
         return Response::json(array('status' => '0', $data));
     }
 }
Example #2
0
if (WEB::_req('POST')) {
    $user_name = WEB::_post('user_name');
    $user_email = WEB::_post('user_email');
    $user_password = WEB::_post('user_password');
    $user_notify = WEB::_post('user_notify');
    $form_error = $u->validateParams(array($user_name, $user_email, $user_password));
    $updateStatus = true;
    if (is_null($form_error)) {
        if (!is_null($user_name)) {
            $updateStatus = $u->updateUserName($user_name);
        }
        if ($updateStatus && !is_null($user_email)) {
            $updateStatus = $u->updateUserEmail($user_email);
        }
        if ($updateStatus && !is_null($user_email)) {
            $updateStatus = $u->updateUserPassword($user_password);
        }
        if ($updateStatus) {
            $updateStatus = $u->updateUserNotify($user_notify);
        }
        if ($updateStatus) {
            $u->refresh();
            $status_message = WEB::_success('User Successfully updated!');
        } else {
            $status_message = WEB::_error('There was an error when you were updating the User.', null);
        }
    } else {
        $status_message = WEB::_error('There is an error when you were updating the User. Please review the form below!', $form_error);
    }
}
?>