Пример #1
0
             @$__loginAppuserpersistentloginDAO->insert($kmli);
         } catch (Exception $ex) {
         }
         // Confirm that we were able to add the row successfully.
         $kmlis = $__loginAppuserpersistentloginDAO->findByKeep_me_logged_in_uniqid($kmli->keep_me_logged_in_uniqid);
         if (count($kmlis) == 1 && $kmlis[0]->user_id == $loggedInUser->id) {
             // Success. Set the cookie and stop trying new unique Ids.
             setcookie('kmliuid', $kmli->keep_me_logged_in_uniqid, time() + $KEEP_ME_LOGGED_IN_TIME, '/');
             return true;
         }
     }
     return false;
 }
 $__loginErrorMsg = '';
 $__loginDB = ConnectionFactory::getConnection();
 $__loginAppuserDAO = new AppuserDAO($__loginDB);
 $__loginAppuserpersistentloginDAO = new AppuserpersistentloginDAO($__loginDB);
 $loggedInUser = null;
 // Try logging in with username and password from a login form POST.
 if ($loggedInUser === null && $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['loginUserName']) && isset($_POST['loginPassword'])) {
     $__loginUsers = $__loginAppuserDAO->findByUser_name(trim($_POST['loginUserName']));
     if (empty($__loginUsers)) {
         $__loginUsers = $__loginAppuserDAO->findByEmail_addr(trim($_POST['loginUserName']));
     }
     if (count($__loginUsers) == 1 && $__loginUsers[0] && $__loginUsers[0]->is_active) {
         if ($__loginUsers[0]->login_failures >= $MAX_LOGIN_FAILURES && strtotime($__loginUsers[0]->last_login_failure) >= time() - $LOGIN_FAILURE_LOCKOUT_TIME) {
             __accountLocked();
         }
         $loggedInUser = $__loginUsers[0];
         $saltidx = strrpos($loggedInUser->password_hash, '{');
         $saltendidx = $saltidx !== false ? strpos($loggedInUser->password_hash, '}', $saltidx) : false;
Пример #2
0
<?php

// DO NOT EDIT THIS FILE.
// This file was generated by searchgen.
// If you need to customize this file, please edit the corresponding
// yaml file in the gencfg directory, and then re-generate this file
// by running searchgen, passing in the table name.
if (isset($command) && $command == 'loadAppuser') {
    header('Content-Type: application/json');
    $db = ConnectionFactory::getConnection();
    $appuserDAO = new AppuserDAO($db);
    $approleDAO = new ApproleDAO($db);
    $id = isset($params['id']) ? (int) trim($params['id']) : 0;
    if ($id <= 0) {
        $rows = array(Appuser::createDefault());
    } else {
        $sql = <<<EOF
select * from appuser pri where pri.id = ?
EOF;
        $ps = new PreparedStatement($sql, 0, 1);
        $ps->setInt($id);
        $rows = $appuserDAO->findWithPreparedStatement($ps);
    }
    $ps1 = new PreparedStatement(<<<EOF
select distinct r.* from appuserrole u_r inner join approle r on r.role_name = u_r.role_name where u_r.user_id = ? order by r.sort_order, r.role_name
EOF
, 0, 0);
    foreach ($rows as &$row) {
        $ps1->clearParams();
        $ps1->setInt($row->id);
        $row->roles = $id <= 0 ? array() : $approleDAO->findWithPreparedStatement($ps1);
Пример #3
0
	}
}
if (returnToSearchMode) {
	parent.setMode(parent.SEARCH_MODE, false);
}
<?php 
            }
            ?>
</script></body></html>
<?php 
            exit;
        case 'deleteAppuser':
            $db = ConnectionFactory::getConnection();
            $db->beginTransaction();
            $committed = false;
            $appuserDAO = new AppuserDAO($db);
            $result = createMsgResultObj();
            $id = isset($_POST['id']) ? (int) trim($_POST['id']) : 0;
            if ($appuserDAO->load($id) === false) {
                $result->errorMsg .= sprintf(_t('crud.idNotFoundRowNotDeleted'), _t('crud.appuser.tableDescription', 'User'), $id) . "\n";
            } else {
                if (function_exists('deleteCheckHook')) {
                    deleteCheckHook();
                }
                if ($result->errorMsg == '' && empty($result->fieldErrors)) {
                    if (function_exists('preDeleteHook')) {
                        preDeleteHook();
                    }
                    try {
                        $success = $appuserDAO->delete($id);
                    } catch (Exception $ex) {