Exemplo n.º 1
0
 public function testInvalidLogIn()
 {
     $dao = new UserDAO();
     $user = new User("userName", "", "userPass", "", "", "", "", "", "", "", 1);
     $dao->registerUser($user);
     $userName = "******";
     $pass = "******";
     $c = new LoginController();
     $res = $c->login($userName, $pass);
     if ($res != -1) {
         echo "{$res}!=-1";
     }
 }
Exemplo n.º 2
0
<?php

include_once dirname(__FILE__) . '\\..\\util.php';
require_controller("loginController");
use Qnet\Controller\LoginController;
$c = new LoginController();
$uid = $c->login($_POST['userName'], $_POST['userPass']);
if ($uid != -1) {
    header("Location: /Qnet/target/classes/php/qnet/ui/viewprofile.php");
} else {
    header("Location: /Qnet/target/classes/php/qnet/ui/login.php?error=true");
}
Exemplo n.º 3
0
<?php

include_once dirname(__FILE__) . '\\..\\util.php';
require_service("validator");
require_controller("loginController");
require_dao('userDAO');
require_model('User');
use Qnet\Service\Validator;
use Qnet\Dao\UserDAO;
use Qnet\Model\User;
use Qnet\Controller\LoginController;
//check_logged();
session_start();
$c = new LoginController();
$dao = new UserDAO();
$validator = new Validator();
$fieldErrors = $validator->validate();
$validateCaptcha = $validator->validateCaptcha();
if ($dao->getUserIdByMail($_POST['mail']) > 0) {
    array_push($fieldErrors, "mail:Mail Already Exits");
}
if ($validateCaptcha && empty($fieldErrors)) {
    $user = new User($_POST['userName'], $_POST['userLastName'], $_POST['mail'], $_POST['password'], $_POST['day'] . '-' . $_POST['month'] . '-' . $_POST['year'], null, null, null, $_POST['institutionName'], null, null);
    User::readProperties($user, $_POST);
    $dao->registerUser($user);
    $c->login($_POST['userName'], $_POST['password']);
    cleanSessionAfterLogin();
    header("Location: viewprofile.php");
    //  header("Location: /Qnet/target/classes/php/qnet/ui/viewprofile.php");
} else {
    $_SESSION["completeForm"] = true;