public function login($email, $password, $longsession = false) {
		$user = $this->getUserByEmail($email);
		if ($user == false) {
			BLog::addToLog('[Users]: login() wrong email!', LL_ERROR);
			return USERS_ERROR_NOSUCHEMAIL;
		}
		if ($user->active == USER_STATUS_NOTACTIVATED) {
			BLog::addToLog('[Users]: Not Activated', LL_ERROR);
			return USERS_ERROR_NOACTIVATED;
		}
		if ($user->active == USER_STATUS_BANNED) {
			BLog::addToLog('[Users]: Banned user', LL_ERROR);
			return USERS_ERROR_BANNED;
		}
		$hash = $this->makepass($email, $password);
		if ($user->password != $hash) {
			BLog::addToLog('[Users]: password hashes not equal! user hash=' . $user->password . '; post hash=' . $hash, LL_ERROR);
			return USERS_ERROR_PASS;
		}
		$options = array('interval' => $longsession ? 2592000 : 10800, 'updatestep' => 60,);
		$sess = BUsersSession::getInstance();
		$sess->newSession($user->id, $options);
		return USERS_ERROR_OK;
	}