Beispiel #1
0
 public function loginUserHandle($userInfo, $register)
 {
     global $request_name;
     $request_name = 'login';
     $_REQUEST['action'] = $_GET['action'] = $_POST['action'] = 'login2';
     $_REQUEST['user'] = $_GET['user'] = $_POST['user'] = $userInfo['member_name'];
     $_REQUEST['passwrd'] = $_GET['passwrd'] = $_POST['passwrd'] = $userInfo['passwd'];
     $_REQUEST['cookielength'] = $_GET['cookielength'] = $_POST['cookielength'] = -1;
     before_action_login();
     require_once 'include/LogInOut.php';
     Login2();
 }
Beispiel #2
0
function action_register()
{
    global $sourcedir, $context, $modSettings, $request_name, $maintenance, $mmessage, $tid_sign_in;
    checkSession();
    if (empty($_POST['password'])) {
        get_error('password cannot be empty');
    }
    if (!($maintenance == 0)) {
        get_error('Forum is in maintenance model or Tapatalk is disabled by forum administrator.');
    }
    if ($modSettings['registration_method'] == 0) {
        $register_mode = 'nothing';
    } else {
        if ($modSettings['registration_method'] == 1) {
            $register_mode = $_POST['emailActivate'] === false ? 'nothing' : 'activation';
        } else {
            $register_mode = 'approval';
        }
    }
    foreach ($_POST as $key => $value) {
        if (!is_array($_POST[$key])) {
            $_POST[$key] = htmltrim__recursive(str_replace(array("\n", "\r"), '', $_POST[$key]));
        }
    }
    $_POST['group'] = 0;
    if ($register_mode == 'nothing' && isset($modSettings['tp_iar_usergroup_assignment'])) {
        $_POST['group'] = $modSettings['tp_iar_usergroup_assignment'];
    }
    $regOptions = array('interface' => $register_mode == 'approval' ? 'guest' : 'admin', 'username' => $_POST['user'], 'email' => $_POST['email'], 'password' => $_POST['password'], 'password_check' => $_POST['password'], 'check_reserved_name' => true, 'check_password_strength' => true, 'check_email_ban' => false, 'send_welcome_email' => isset($_POST['emailPassword']) || empty($_POST['password']), 'require' => $register_mode, 'memberGroup' => (int) $_POST['group']);
    define('mobi_register', 1);
    require_once $sourcedir . '/Subs-Members.php';
    $memberID = registerMember($regOptions);
    if (!empty($memberID)) {
        $context['new_member'] = array('id' => $memberID, 'name' => $_POST['user'], 'href' => $scripturl . '?action=profile;u=' . $memberID, 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $memberID . '">' . $_POST['user'] . '</a>');
        $context['registration_done'] = sprintf($txt['admin_register_done'], $context['new_member']['link']);
    }
    if (!empty($memberID) && $tid_sign_in) {
        //update profile
        if (isset($_POST['tid_profile']) && !empty($_POST['tid_profile']) && is_array($_POST['tid_profile'])) {
            $profile_vars = array('avatar' => $_POST['tid_profile']['avatar_url']);
            updateMemberData($memberID, $profile_vars);
        }
        //simulate login
        $request_name = 'login';
        $_REQUEST['action'] = $_GET['action'] = $_POST['action'] = 'login2';
        before_action_login();
        require_once 'include/LogInOut.php';
        Login2();
    }
}