[ABD]AlternateLogin(Windows Live,Facebook,OpenID)

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
Locked
mikymoon
Registered User
Posts: 27
Joined: Mon Mar 29, 2004 6:36 am

Re: [BETA]AlternateLogin(Windows Live,Facebook,Twitter)

Post by mikymoon »

Mrtb wrote:I have this error when I try to login in the ACP with a facebook user:
SQL ERROR [ mysqli ]

Unknown column 'al_oi_id' in 'field list' [1054]

SQL

SELECT user_email, user_allow_viewonline, al_fb_id, al_wl_id, al_oi_id FROM phpbb3_users WHERE phpbb3_users.user_id='54'

BACKTRACE

FILE: includes/db/mysqli.php
LINE: 163
CALL: dbal->sql_error()

FILE: includes/functions_alternatelogin.php
LINE: 65
CALL: dbal_mysqli->sql_query()

FILE: adm/index.php
LINE: 36
CALL: al_validate_admin()
This is the same it happens to me... but thanks to
mjimeyg wrote:@milkymoon: I also had that database issue and that is because the field wasn't created during installation. If you manually create the field it will immediately fix the error. This is something that will need to be fixed in the SQL portion of the installation.
It fixed .. :)

mikymoon
Registered User
Posts: 27
Joined: Mon Mar 29, 2004 6:36 am

Re: [BETA]AlternateLogin(Windows Live,Facebook,Twitter)

Post by mikymoon »

mjimeyg wrote:@milkymoon: I also had that database issue and that is because the field wasn't created during installation. If you manually create the field it will immediately fix the error. This is something that will need to be fixed in the SQL portion of the installation
Thanks .. I did and it works..
I can loggin as ADMIN clicking on "connect with facebook" , it work fine for me "You have been successfully logged in!"
until i have to go to the ACP ... it not let me go.. "Your password is not correct" and after three atempts..."You exceeded the maximum allowed number of login attempts. In addition to your username and password you now also have to solve the CAPTCHA below".
If I dissable AlternateLogin ,via UCP ,Connect with facebook..... I can go to the ACP...

Thanks..

User avatar
mjimeyg
Registered User
Posts: 840
Joined: Sat Aug 29, 2009 7:38 pm
Location: London

Re: [BETA]AlternateLogin(Windows Live,Facebook,Twitter)

Post by mjimeyg »

Helter Skelter wrote:fresh phpBB3.0.9 with automod.
AlternateLogin Version:2011.03.05

debug on shows these errors

Code: Select all

[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4456: Undefined index: al_settings
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4490: Undefined index: al_settings
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4496: Undefined index: alternatelogin_facebook_appid
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4498: Undefined index: al_fb_xdreciever_path
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4499: Undefined index: al_fb_app_id
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4500: Undefined index: al_fb_app_id
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4501: Undefined variable: session
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4503: Undefined variable: loginUrl
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4504: Undefined variable: logoutUrl

First: You are using an old version, the latest version is stated in the first post of this topic.

Second: The errors are usually a result of the database entries not being installed. You can find the SQL commands to enter them manually here: http://wiki.consof.com/index.php?title=AL_SQL_Queries
Questions answered via forums only, no pms or emails. Thank you.

ConSof Alternate Login for phpBB

Image Image

User avatar
Mrtb
Registered User
Posts: 111
Joined: Sat Jun 02, 2007 6:12 pm
Location: Ancona, Italy

Re: [BETA]AlternateLogin(Windows Live,Facebook,Twitter)

Post by Mrtb »

I personally fixed some bug I found in this MOD:

1. "Unknown column 'al_oi_id' in 'field list' [1054]": You're already fixed it by changing the sql queries from "al_oi_id" to "al_tw_id" in functions_alternatelogin.php and al_fb_connect.php files.

2. Users can't login into ACP page if they need to set their own password and if they didn't: You need to replace the functions_alternatelogin.php and al_fb_register.php files with the below ones

3. Once you logged in ACP you didn't see the default message "You have successfully authenticated and will now be redirected to the Administration Control Panel.": replace the functions_alternatelogin.php file with the below ones

functions_alternatelogin.php

Code: Select all

<?php
/*
	COPYRIGHT 2009 Michael J Goonawardena

	This file is part of ConSof Alternate Login.

    ConSof Alternate Login is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    ConSof Alternate Login is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with ConSof Alternate Login.  If not, see <http://www.gnu.org/licenses/>.*/
if (!defined('IN_PHPBB'))
{
	exit;
}

define('AL_FACEBOOK_LOGIN', 0);
define('AL_MYSPACE_LOGIN', 2);
define('AL_MYSPACE_PROFILE', 3);
define('AL_GOOGLE_LOGIN', 4);
define('AL_GOOGLE_PROFILE', 5);
define('AL_TWITTER_LOGIN', 6);
define('AL_TWITTER_PROFILE', 7);
define('AL_WINDOWSLIVE_LOGIN', 8);
define('AL_WINDOWSLIVE_PROFILE', 9);

define('AL_FB_SYNC_PROFILE', 1);
define('AL_FB_SYNC_AVATAR', 11);
define('AL_FB_SYNC_STATUS', 12);

define('AL_HIDE_POST_LOGON', 10);	// Does the user want to be asked if they want to see the 'hide online' and autologin screen after verification?

define('AL_USER_OPTION_COUNT', 13);

define('WL_COOKIE', 'webauthtoken');
define('PCOOKIE', time() + (10 * 365 * 24 * 60 * 60));

define('HTTP_GET', 0);
define('HTTP_POST', 1);



/**
* Validate an Alternate Login ID for Admin privaleges..
*
* @return False if the login failed, True if success.
*/
function al_validate_admin()
{
	global $template, $db, $config, $user, $auth, $phpEx, $phpbb_root_path;

	$user->add_lang('acp/common');

	$sql = "SELECT user_password, user_email, user_allow_viewonline, al_fb_id, al_wl_id, al_tw_id" .
			" FROM " . USERS_TABLE .
			" WHERE " . USERS_TABLE . ".user_id='" . $user->data['user_id'] . "'";

	$result = $db->sql_query($sql);

	$row = $db->sql_fetchrow($result);

	$username = $user->data['username'];
	$storedpass = $user->data['user_password'];
	$password = '';

	if($row)
	{
		if($row['al_fb_id'] != NULL)
		{
			$password = substr(md5($user->data['al_fb_id'] . $config['al_fb_key'] . $config['al_fb_secret']), 0, $config['max_pass_chars']);
		}
		elseif($row['al_wl_id'] != NULL)
		{
			$password = substr($row['al_wl_id'], 0, $config['max_pass_chars']);
		}
		elseif($row['al_tw_id'] != NULL)
		{
			$password = substr($row['al_tw_id'], 0, $config['max_pass_chars']);
		}
		
		$hide_online = $row['user_allow_viewonline'];

		if (phpbb_hash($password) != $storedpass)
		{
		  login_box('', $user->lang['LOGIN_ADMIN_CONFIRM'], $user->lang['LOGIN_ADMIN_SUCCESS'], true, false);
    }
    else
    {
		  $result = $auth->login($username, $password, false, $hide_online, true);
		}


		if($result['status'] == LOGIN_SUCCESS)
		{
			add_log('admin', 'LOG_ADMIN_AUTH_SUCCESS');

			$redirect = "{$phpbb_root_path}adm/index.$phpEx";
			$message = $user->lang['LOGIN_ADMIN_SUCCESS'];
			$l_redirect = $user->lang['PROCEED_TO_ACP'];

			// append/replace SID (may change during the session for AOL users)
			$redirect = reapply_sid($redirect);

			// Special case... the user is effectively banned, but we allow founders to login
			if (defined('IN_CHECK_BAN') && $result['user_row']['user_type'] != USER_FOUNDER)
			{
				return;
			}

			$redirect = meta_refresh(3, $redirect);
			trigger_error($message . '<br /><br />' . sprintf($l_redirect, '<a href="' . $redirect . '">', '</a>'));

		}
		else
		{
			if ($user->data['is_registered'])
			{
				add_log('admin', 'LOG_ADMIN_AUTH_FAIL');
			}
			// Something failed, determine what...
			if ($result['status'] == LOGIN_BREAK)
			{
				trigger_error($result['error_msg']);
			}

			// Special cases... determine
			switch ($result['status'])
			{
				case LOGIN_ERROR_ATTEMPTS:

					// Show confirm image
					$sql = 'DELETE FROM ' . CONFIRM_TABLE . "
						WHERE session_id = '" . $db->sql_escape($user->session_id) . "'
							AND confirm_type = " . CONFIRM_LOGIN;
					$db->sql_query($sql);

					// Generate code
					$code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS));
					$confirm_id = md5(unique_id($user->ip));
					$seed = hexdec(substr(unique_id(), 4, 10));

					// compute $seed % 0x7fffffff
					$seed -= 0x7fffffff * floor($seed / 0x7fffffff);

					$sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array(
						'confirm_id'	=> (string) $confirm_id,
						'session_id'	=> (string) $user->session_id,
						'confirm_type'	=> (int) CONFIRM_LOGIN,
						'code'			=> (string) $code,
						'seed'			=> (int) $seed)
					);
					$db->sql_query($sql);

					$template->assign_vars(array(
						'S_CONFIRM_CODE'			=> true,
						'CONFIRM_ID'				=> $confirm_id,
						'CONFIRM_IMAGE'				=> '<img src="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=confirm&id=' . $confirm_id . '&type=' . CONFIRM_LOGIN) . '" alt="" title="" />',
						'L_LOGIN_CONFIRM_EXPLAIN'	=> sprintf($user->lang['LOGIN_CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'),
					));

					$err = $user->lang[$result['error_msg']];

				break;

				case LOGIN_ERROR_PASSWORD_CONVERT:
					$err = sprintf(
						$user->lang[$result['error_msg']],
						($config['email_enable']) ? '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') . '">' : '',
						($config['email_enable']) ? '</a>' : '',
						($config['board_contact']) ? '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">' : '',
						($config['board_contact']) ? '</a>' : ''
					);
				break;

				// Username, password, etc...
				default:
					$err = $user->lang[$result['error_msg']];

					// Assign admin contact to some error messages
					if ($result['error_msg'] == 'LOGIN_ERROR_USERNAME' || $result['error_msg'] == 'LOGIN_ERROR_PASSWORD')
					{
						$err = (!$config['board_contact']) ? sprintf($user->lang[$result['error_msg']], '', '') : sprintf($user->lang[$result['error_msg']], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>');
					}

				break;
			}
			trigger_error($err);
		}
	}
}

function get_wl_tokens($cid, $authorization_code, $refresh_token)
{
    global $config, $user;
    
    $url = "https://oauth.live.com/token?";
    $url .= "client_id={$config['al_wl_client_id']}";
    $url .= "&redirect_uri=" . urlencode($config['al_wl_callback']);
    $url .= "&client_secret={$config['al_wl_secret']}";
    if($authorization_code)
    {
        $url .= "&code={$authorization_code}";
        $url .= "&grant_type=authorization_code";
    }
    elseif($refresh_token)
    {
        $url .= "&refresh_token={$refresh_token}";
        $url .= "&grant_type=refresh_token";
    }
    else
    {
        trigger_error($user->lang['MISSING_AUTH_OR_REFRESH']);
    }
    
    $ch = curl_init();
    
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
    
    $data = curl_exec($ch);
    
    if(curl_errno($ch))
    {
        trigger_error($user->lang['ERROR_RETRIEVING_TOKENS']);
    }

    curl_close($ch);
    
    $data_decoded = json_decode($data);
    
    
    if($data_decoded->error)
    {
        trigger_error($data_decoded->error);
    }
    
    return $data_decoded;
}

function get_wl_rest_request($access_token, $path, $method = HTTP_GET, $headers = NULL, $method_data = NULL)
{
    $url = "https://apis.live.net/v5.0/{$path}/?access_token={$access_token}";
    
    $ch = curl_init();
    
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    
    if($method == HTTP_GET)
    {
        curl_setopt($ch, CURLOPT_HTTPGET, true);
    }
    elseif($method == HTTP_POST)
    {
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $method_data);
    }
    else
    {
        trigger_error($user->lang['ERROR_UNDETERMINED_HTTP_METHOD']);
    }
    
    $data = curl_exec($ch);
    
    if(curl_errno($ch))
    {
        return false;
    }

    curl_close($ch);
    
    return json_decode($data);
}



function get_fb_access_token()
{
    global $config, $db, $user;
    $my_url = generate_board_url() . "/alternatelogin/al_fb_connect.php";

    $code = $_REQUEST["code"];

    if(empty($code)) {
        $dialog_url = "http://www.facebook.com/dialog/oauth?client_id="
            . $config['al_fb_id'] . "&redirect_uri=" . urlencode($my_url) . "&scope=user_location,user_activities,user_birthday,user_interests,user_status,user_website,user_work_history";

        echo("<script> top.location.href='" . $dialog_url . "'</script>");
    }

    $token_url = "https://graph.facebook.com/oauth/access_token?client_id="
        . $config['al_fb_id'] . "&redirect_uri=" . urlencode($my_url) . "&client_secret="
        . $config['al_fb_secret'] . "&code=" . $code;

    $ch = curl_init();
    
    curl_setopt($ch, CURLOPT_URL, $token_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    
    curl_setopt($ch, CURLOPT_HTTPGET, true);
    
    
    $access_token = curl_exec($ch);
    
    if(curl_errno($ch))
    {
        return false;
    }

    curl_close($ch);
    
    //$access_token = file_get_contents($token_url);

    return $access_token;
}

function get_fb_data($url)
{ 
    $ch = curl_init();
    
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    
    curl_setopt($ch, CURLOPT_HTTPGET, true);
    
    
    $data = curl_exec($ch);
    
    if(curl_errno($ch))
    {
        return false;
    }

    curl_close($ch);
    
    return $data;
}
?>
al_fb_register.php

Code: Select all

<?php
/*
	COPYRIGHT 2011 Michael J Goonawardena

	This file is part of ConSof Alternate Login.

    ConSof Alternate Login is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    ConSof Alternate Login is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with ConSof Alternate Login.  If not, see <http://www.gnu.org/licenses/>.*/


// Basic setup of phpBB variables.
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);

// Load include files.
include($phpbb_root_path . 'common.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_alternatelogin.' . $phpEx);	// Custom Alternate Login functions.

// Set up a new user session.
$user->session_begin();
$auth->acl($user->data);
$user->setup('ucp');
$user->add_lang('mods/alternatelogin');	// Global Alternate Login language file.
$user->add_lang('mods/info_ucp_alternatelogin');

include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_alternatelogin.' . $phpEx);

$coppa			= (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false;
$agreed			= (!empty($_POST['agreed'])) ? 1 : 0;
$submit			= (isset($_POST['submit'])) ? true : false;
$change_lang            = request_var('change_lang', '');
$user_lang		= request_var('lang', $user->lang_name);
$al_login		= (request_var('al_login', 0) == 1) ? true : false;
$al_login_type		= request_var('al_login_type', 0);
$fb_user 		= request_var('al_fb_user', '');

if($_REQUEST)
{
    $signed_request = $_REQUEST['signed_request'];

    list($encoded_sig, $payload) = explode('.', $signed_request, 2);

    $sig = base64_decode(strtr($encoded_sig, '-_', '+/'));

    $fb_reg_data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);

    if(strtoupper($fb_reg_data['algorithm']) !== 'HMAC-SHA256')
    {
        trigger_error('Unknown algorithm. Expected HMAC-SHA256');

        return null;
    }

    $expected_sig = $expected_sig = hash_hmac('sha256', $payload, $config['al_fb_secret'], $raw = true);
    if ($sig !== $expected_sig)
    {
        trigger_error('Bad Signed JSON signature!');
        return null;
    }

}
else
{
    trigger_error($user->lang['ERROR']);
}

$data = array(
    'username'			=> $fb_reg_data['registration']['name_for_username'] ? utf8_normalize_nfc($fb_reg_data['registration']['name']) : utf8_normalize_nfc($fb_reg_data['registration']['username']),
    'email'			=> strtolower($fb_reg_data['registration']['email']),
    'email_confirm'		=> strtolower($fb_reg_data['registration']['email']),
    'lang'                      => basename(request_var('lang', $user->lang_name)),
    'tz'			=> request_var('tz', (float) $timezone),
);

$validate_username = validate_username($data['username']);

if($validate_username)
{
    trigger_error($user->lang[$validate_username . '_USERNAME'] . ' <br /><br /><a href="' . $phpbb_root_path . '/alternatelogin/al_fb_registration.' . $phpEx . '?mode=register">' . $user->lang['BACK_TO_PREV'] . "</a>");            
}

if($config['al_require_password'])
{
    $new_password = $fb_reg_data['registration']['password'];
}
else
{
    $new_password = substr(md5($fb_user . $config['al_fb_key'] . $config['al_fb_secret']), 0, $config['max_pass_chars']);
}
$data['new_password'] = $new_password;
$data['password_confirm'] = $new_password;

$error = validate_data($data, array(
    'username'			=> array(
                                        array('string', false, $config['min_name_chars'], $config['max_name_chars']),
                                        array('username', '')),
    'new_password'		=> array(
                                        array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
                                        array('password')),
    'password_confirm'          => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
    'email'                     => array(
                                        array('string', false, 6, 60),
                                        array('email')),
    'email_confirm'		=> array('string', false, 6, 60),
    'tz'			=> array('num', false, -14, 14),
    'lang'			=> array('match', false, '#^[a-z_\-]{2,}$#i'),
));



// DNSBL check
if ($config['check_dnsbl'])
{
    if (($dnsbl = $user->check_dnsbl('register')) !== false)
    {
        $error[] = sprintf($user->lang['IP_BLACKLISTED'], $user->ip, $dnsbl[1]);
    }
}

if (!sizeof($error))
{
    if ($data['new_password'] != $data['password_confirm'])
    {
        $error[] = $user->lang['NEW_PASSWORD_ERROR'];
    }

    if ($data['email'] != $data['email_confirm'])
    {
        $error[] = $user->lang['NEW_EMAIL_ERROR'];
    }
}

if (!sizeof($error))
{
    $server_url = generate_board_url();

    // Which group by default?
    $group_name = ($coppa) ? 'REGISTERED_COPPA' : 'REGISTERED';

    $sql = 'SELECT group_id
            FROM ' . GROUPS_TABLE . "
            WHERE group_name = '" . $db->sql_escape($group_name) . "'
                    AND group_type = " . GROUP_SPECIAL;
    $result = $db->sql_query($sql);
    $row = $db->sql_fetchrow($result);
    $db->sql_freeresult($result);

    if (!$row)
    {
        trigger_error('NO_GROUP');
    }

    $group_id = $row['group_id'];

    if (($coppa ||
            $config['require_activation'] == USER_ACTIVATION_SELF ||
            $config['require_activation'] == USER_ACTIVATION_ADMIN) && $config['email_enable'])
    {
        $user_actkey = gen_rand_string(10);
        $key_len = 54 - (strlen($server_url));
        $key_len = ($key_len < 6) ? 6 : $key_len;
        $user_actkey = substr($user_actkey, 0, $key_len);

        $user_type = USER_INACTIVE;
        $user_inactive_reason = INACTIVE_REGISTER;
        $user_inactive_time = time();
    }
    else
    {
        $user_type = USER_NORMAL;
        $user_actkey = '';
        $user_inactive_reason = 0;
        $user_inactive_time = 0;
    }

    $user_row = array(
        'username'				=> $data['username'],
        'user_password'			=> phpbb_hash($data['new_password']),
        'user_email'			=> $data['email'],
        'group_id'				=> (int) $group_id,
        'user_timezone'			=> (float) $data['tz'],
        'user_dst'				=> $is_dst,
        'user_lang'				=> $data['lang'],
        'user_type'				=> $user_type,
        'user_actkey'			=> $user_actkey,
        'user_ip'				=> $user->ip,
        'user_regdate'			=> time(),
        'user_inactive_reason'	=> $user_inactive_reason,
        'user_inactive_time'	=> $user_inactive_time,
        'al_fb_id'              => $fb_user,
    );

    if ($config['new_member_post_limit'])
    {
        $user_row['user_new'] = 1;
    }

    // Register user...
    $user_id = user_add($user_row, $cp_data);

    // This should not happen, because the required variables are listed above...
    if ($user_id === false)
    {
        trigger_error('NO_USER', E_USER_ERROR);
    }
    

    // DB Error
    if(!$result)
    {
            trigger_error('Unable to connect with phpBB database.');
    }

    $al_email_lang = $user->lang['FACEBOOK'];

    if ($coppa && $config['email_enable'])
    {
        $message = $user->lang['ACCOUNT_COPPA'];
        if($al_login)
        {
                $email_template = 'coppa_welcome_inactive_alternatelogin';
        }
        else
        {
                $email_template = 'coppa_welcome_inactive';
        }
    }
    else if ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable'])
    {
        $message = $user->lang['ACCOUNT_INACTIVE'];
        if($al_login)
        {
                $email_template = 'user_welcome_inactive_alternatelogin';
        }
        else
        {
                $email_template = 'user_welcome_inactive';
        }
    }
    else if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $config['email_enable'])
    {
        $message = $user->lang['ACCOUNT_INACTIVE_ADMIN'];
        if($al_login)
        {
                $email_template = 'admin_welcome_inactive_alternatelogin';
        }
        else
        {
                $email_template = 'admin_welcome_inactive';
        }
    }
    else
    {
        $message = $user->lang['ACCOUNT_ADDED'];
        if($al_login)
        {
                $email_template = 'user_welcome_alternatelogin';
        }
        else
        {
                $email_template = 'user_welcome';
        }
    }

    if ($config['email_enable'])
    {
            include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);

            $messenger = new messenger(false);

            $messenger->template($email_template, $data['lang']);

            $messenger->to($data['email'], $data['username']);

            $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
            $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
            $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
            $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);

            $messenger->assign_vars(array(
                    'WELCOME_MSG'	=> htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])),
                    'USERNAME'		=> htmlspecialchars_decode($data['username']),
                    'PASSWORD'		=> htmlspecialchars_decode($data['new_password']),
                    'AL_LOGIN_TYPE'		=> $al_email_lang,
                    'U_ACTIVATE'	=> "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
            );

            if ($coppa)
            {
                    $messenger->assign_vars(array(
                            'FAX_INFO'		=> $config['coppa_fax'],
                            'MAIL_INFO'		=> $config['coppa_mail'],
                            'EMAIL_ADDRESS'	=> $data['email'])
                    );
            }

            $messenger->send(NOTIFY_EMAIL);

            if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
            {
                    // Grab an array of user_id's with a_user permissions ... these users can activate a user
                    $admin_ary = $auth->acl_get_list(false, 'a_user', false);
                    $admin_ary = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array();

                    // Also include founders
                    $where_sql = ' WHERE user_type = ' . USER_FOUNDER;

                    if (sizeof($admin_ary))
                    {
                            $where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary);
                    }

                    $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
                            FROM ' . USERS_TABLE . ' ' .
                            $where_sql;
                    $result = $db->sql_query($sql);

                    while ($row = $db->sql_fetchrow($result))
                    {
                            $messenger->template('admin_activate', $row['user_lang']);
                            $messenger->to($row['user_email'], $row['username']);
                            $messenger->im($row['user_jabber'], $row['username']);

                            $messenger->assign_vars(array(
                                    'USERNAME'			=> htmlspecialchars_decode($data['username']),
                                    'U_USER_DETAILS'	=> "$server_url/memberlist.$phpEx?mode=viewprofile&u=$user_id",
                                    'U_ACTIVATE'		=> "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
                            );

                            $messenger->send($row['user_notify_type']);
                    }
                    $db->sql_freeresult($result);
            }
    }
    
    if(sizeof($error))
    {
        $message = '';
        foreach($error as $e)
        {
            $message .= $user->lang[$e] . '<br />';
        }
        
        trigger_error($message);
    }
    
    $message = $message . '<br /><br />' . sprintf($user->lang['PREV_PAGE'], '<a href="' . append_sid("{$phpbb_root_path}alternatelogin/al_fb_registration.$phpEx") . '">', '</a>');

    $message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
    trigger_error($message);
}
?>
I hope this changes will be included in the next release! :)

User avatar
mjimeyg
Registered User
Posts: 840
Joined: Sat Aug 29, 2009 7:38 pm
Location: London

Re: [BETA]AlternateLogin(Windows Live,Facebook,Twitter)

Post by mjimeyg »

Mrtb wrote:I personally fixed some bug I found in this MOD:

1. "Unknown column 'al_oi_id' in 'field list' [1054]": You're already fixed it by changing the sql queries from "al_oi_id" to "al_tw_id" in functions_alternatelogin.php and al_fb_connect.php files.

2. Users can't login into ACP page if they need to set their own password and if they didn't: You need to replace the functions_alternatelogin.php and al_fb_register.php files with the below ones

3. Once you logged in ACP you didn't see the default message "You have successfully authenticated and will now be redirected to the Administration Control Panel.": replace the functions_alternatelogin.php file with the below ones

functions_alternatelogin.php

Code: Select all

<?php
/*
	COPYRIGHT 2009 Michael J Goonawardena

	This file is part of ConSof Alternate Login.

    ConSof Alternate Login is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    ConSof Alternate Login is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with ConSof Alternate Login.  If not, see <http://www.gnu.org/licenses/>.*/
if (!defined('IN_PHPBB'))
{
	exit;
}

define('AL_FACEBOOK_LOGIN', 0);
define('AL_MYSPACE_LOGIN', 2);
define('AL_MYSPACE_PROFILE', 3);
define('AL_GOOGLE_LOGIN', 4);
define('AL_GOOGLE_PROFILE', 5);
define('AL_TWITTER_LOGIN', 6);
define('AL_TWITTER_PROFILE', 7);
define('AL_WINDOWSLIVE_LOGIN', 8);
define('AL_WINDOWSLIVE_PROFILE', 9);

define('AL_FB_SYNC_PROFILE', 1);
define('AL_FB_SYNC_AVATAR', 11);
define('AL_FB_SYNC_STATUS', 12);

define('AL_HIDE_POST_LOGON', 10);	// Does the user want to be asked if they want to see the 'hide online' and autologin screen after verification?

define('AL_USER_OPTION_COUNT', 13);

define('WL_COOKIE', 'webauthtoken');
define('PCOOKIE', time() + (10 * 365 * 24 * 60 * 60));

define('HTTP_GET', 0);
define('HTTP_POST', 1);



/**
* Validate an Alternate Login ID for Admin privaleges..
*
* @return False if the login failed, True if success.
*/
function al_validate_admin()
{
	global $template, $db, $config, $user, $auth, $phpEx, $phpbb_root_path;

	$user->add_lang('acp/common');

	$sql = "SELECT user_password, user_email, user_allow_viewonline, al_fb_id, al_wl_id, al_tw_id" .
			" FROM " . USERS_TABLE .
			" WHERE " . USERS_TABLE . ".user_id='" . $user->data['user_id'] . "'";

	$result = $db->sql_query($sql);

	$row = $db->sql_fetchrow($result);

	$username = $user->data['username'];
	$storedpass = $user->data['user_password'];
	$password = '';

	if($row)
	{
		if($row['al_fb_id'] != NULL)
		{
			$password = substr(md5($user->data['al_fb_id'] . $config['al_fb_key'] . $config['al_fb_secret']), 0, $config['max_pass_chars']);
		}
		elseif($row['al_wl_id'] != NULL)
		{
			$password = substr($row['al_wl_id'], 0, $config['max_pass_chars']);
		}
		elseif($row['al_tw_id'] != NULL)
		{
			$password = substr($row['al_tw_id'], 0, $config['max_pass_chars']);
		}
		
		$hide_online = $row['user_allow_viewonline'];

		if (phpbb_hash($password) != $storedpass)
		{
		  login_box('', $user->lang['LOGIN_ADMIN_CONFIRM'], $user->lang['LOGIN_ADMIN_SUCCESS'], true, false);
    }
    else
    {
		  $result = $auth->login($username, $password, false, $hide_online, true);
		}


		if($result['status'] == LOGIN_SUCCESS)
		{
			add_log('admin', 'LOG_ADMIN_AUTH_SUCCESS');

			$redirect = "{$phpbb_root_path}adm/index.$phpEx";
			$message = $user->lang['LOGIN_ADMIN_SUCCESS'];
			$l_redirect = $user->lang['PROCEED_TO_ACP'];

			// append/replace SID (may change during the session for AOL users)
			$redirect = reapply_sid($redirect);

			// Special case... the user is effectively banned, but we allow founders to login
			if (defined('IN_CHECK_BAN') && $result['user_row']['user_type'] != USER_FOUNDER)
			{
				return;
			}

			$redirect = meta_refresh(3, $redirect);
			trigger_error($message . '<br /><br />' . sprintf($l_redirect, '<a href="' . $redirect . '">', '</a>'));

		}
		else
		{
			if ($user->data['is_registered'])
			{
				add_log('admin', 'LOG_ADMIN_AUTH_FAIL');
			}
			// Something failed, determine what...
			if ($result['status'] == LOGIN_BREAK)
			{
				trigger_error($result['error_msg']);
			}

			// Special cases... determine
			switch ($result['status'])
			{
				case LOGIN_ERROR_ATTEMPTS:

					// Show confirm image
					$sql = 'DELETE FROM ' . CONFIRM_TABLE . "
						WHERE session_id = '" . $db->sql_escape($user->session_id) . "'
							AND confirm_type = " . CONFIRM_LOGIN;
					$db->sql_query($sql);

					// Generate code
					$code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS));
					$confirm_id = md5(unique_id($user->ip));
					$seed = hexdec(substr(unique_id(), 4, 10));

					// compute $seed % 0x7fffffff
					$seed -= 0x7fffffff * floor($seed / 0x7fffffff);

					$sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array(
						'confirm_id'	=> (string) $confirm_id,
						'session_id'	=> (string) $user->session_id,
						'confirm_type'	=> (int) CONFIRM_LOGIN,
						'code'			=> (string) $code,
						'seed'			=> (int) $seed)
					);
					$db->sql_query($sql);

					$template->assign_vars(array(
						'S_CONFIRM_CODE'			=> true,
						'CONFIRM_ID'				=> $confirm_id,
						'CONFIRM_IMAGE'				=> '<img src="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=confirm&id=' . $confirm_id . '&type=' . CONFIRM_LOGIN) . '" alt="" title="" />',
						'L_LOGIN_CONFIRM_EXPLAIN'	=> sprintf($user->lang['LOGIN_CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'),
					));

					$err = $user->lang[$result['error_msg']];

				break;

				case LOGIN_ERROR_PASSWORD_CONVERT:
					$err = sprintf(
						$user->lang[$result['error_msg']],
						($config['email_enable']) ? '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') . '">' : '',
						($config['email_enable']) ? '</a>' : '',
						($config['board_contact']) ? '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">' : '',
						($config['board_contact']) ? '</a>' : ''
					);
				break;

				// Username, password, etc...
				default:
					$err = $user->lang[$result['error_msg']];

					// Assign admin contact to some error messages
					if ($result['error_msg'] == 'LOGIN_ERROR_USERNAME' || $result['error_msg'] == 'LOGIN_ERROR_PASSWORD')
					{
						$err = (!$config['board_contact']) ? sprintf($user->lang[$result['error_msg']], '', '') : sprintf($user->lang[$result['error_msg']], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>');
					}

				break;
			}
			trigger_error($err);
		}
	}
}

function get_wl_tokens($cid, $authorization_code, $refresh_token)
{
    global $config, $user;
    
    $url = "https://oauth.live.com/token?";
    $url .= "client_id={$config['al_wl_client_id']}";
    $url .= "&redirect_uri=" . urlencode($config['al_wl_callback']);
    $url .= "&client_secret={$config['al_wl_secret']}";
    if($authorization_code)
    {
        $url .= "&code={$authorization_code}";
        $url .= "&grant_type=authorization_code";
    }
    elseif($refresh_token)
    {
        $url .= "&refresh_token={$refresh_token}";
        $url .= "&grant_type=refresh_token";
    }
    else
    {
        trigger_error($user->lang['MISSING_AUTH_OR_REFRESH']);
    }
    
    $ch = curl_init();
    
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
    
    $data = curl_exec($ch);
    
    if(curl_errno($ch))
    {
        trigger_error($user->lang['ERROR_RETRIEVING_TOKENS']);
    }

    curl_close($ch);
    
    $data_decoded = json_decode($data);
    
    
    if($data_decoded->error)
    {
        trigger_error($data_decoded->error);
    }
    
    return $data_decoded;
}

function get_wl_rest_request($access_token, $path, $method = HTTP_GET, $headers = NULL, $method_data = NULL)
{
    $url = "https://apis.live.net/v5.0/{$path}/?access_token={$access_token}";
    
    $ch = curl_init();
    
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    
    if($method == HTTP_GET)
    {
        curl_setopt($ch, CURLOPT_HTTPGET, true);
    }
    elseif($method == HTTP_POST)
    {
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $method_data);
    }
    else
    {
        trigger_error($user->lang['ERROR_UNDETERMINED_HTTP_METHOD']);
    }
    
    $data = curl_exec($ch);
    
    if(curl_errno($ch))
    {
        return false;
    }

    curl_close($ch);
    
    return json_decode($data);
}



function get_fb_access_token()
{
    global $config, $db, $user;
    $my_url = generate_board_url() . "/alternatelogin/al_fb_connect.php";

    $code = $_REQUEST["code"];

    if(empty($code)) {
        $dialog_url = "http://www.facebook.com/dialog/oauth?client_id="
            . $config['al_fb_id'] . "&redirect_uri=" . urlencode($my_url) . "&scope=user_location,user_activities,user_birthday,user_interests,user_status,user_website,user_work_history";

        echo("<script> top.location.href='" . $dialog_url . "'</script>");
    }

    $token_url = "https://graph.facebook.com/oauth/access_token?client_id="
        . $config['al_fb_id'] . "&redirect_uri=" . urlencode($my_url) . "&client_secret="
        . $config['al_fb_secret'] . "&code=" . $code;

    $ch = curl_init();
    
    curl_setopt($ch, CURLOPT_URL, $token_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    
    curl_setopt($ch, CURLOPT_HTTPGET, true);
    
    
    $access_token = curl_exec($ch);
    
    if(curl_errno($ch))
    {
        return false;
    }

    curl_close($ch);
    
    //$access_token = file_get_contents($token_url);

    return $access_token;
}

function get_fb_data($url)
{ 
    $ch = curl_init();
    
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    
    curl_setopt($ch, CURLOPT_HTTPGET, true);
    
    
    $data = curl_exec($ch);
    
    if(curl_errno($ch))
    {
        return false;
    }

    curl_close($ch);
    
    return $data;
}
?>
al_fb_register.php

Code: Select all

<?php
/*
	COPYRIGHT 2011 Michael J Goonawardena

	This file is part of ConSof Alternate Login.

    ConSof Alternate Login is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    ConSof Alternate Login is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with ConSof Alternate Login.  If not, see <http://www.gnu.org/licenses/>.*/


// Basic setup of phpBB variables.
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);

// Load include files.
include($phpbb_root_path . 'common.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_alternatelogin.' . $phpEx);	// Custom Alternate Login functions.

// Set up a new user session.
$user->session_begin();
$auth->acl($user->data);
$user->setup('ucp');
$user->add_lang('mods/alternatelogin');	// Global Alternate Login language file.
$user->add_lang('mods/info_ucp_alternatelogin');

include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_alternatelogin.' . $phpEx);

$coppa			= (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false;
$agreed			= (!empty($_POST['agreed'])) ? 1 : 0;
$submit			= (isset($_POST['submit'])) ? true : false;
$change_lang            = request_var('change_lang', '');
$user_lang		= request_var('lang', $user->lang_name);
$al_login		= (request_var('al_login', 0) == 1) ? true : false;
$al_login_type		= request_var('al_login_type', 0);
$fb_user 		= request_var('al_fb_user', '');

if($_REQUEST)
{
    $signed_request = $_REQUEST['signed_request'];

    list($encoded_sig, $payload) = explode('.', $signed_request, 2);

    $sig = base64_decode(strtr($encoded_sig, '-_', '+/'));

    $fb_reg_data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);

    if(strtoupper($fb_reg_data['algorithm']) !== 'HMAC-SHA256')
    {
        trigger_error('Unknown algorithm. Expected HMAC-SHA256');

        return null;
    }

    $expected_sig = $expected_sig = hash_hmac('sha256', $payload, $config['al_fb_secret'], $raw = true);
    if ($sig !== $expected_sig)
    {
        trigger_error('Bad Signed JSON signature!');
        return null;
    }

}
else
{
    trigger_error($user->lang['ERROR']);
}

$data = array(
    'username'			=> $fb_reg_data['registration']['name_for_username'] ? utf8_normalize_nfc($fb_reg_data['registration']['name']) : utf8_normalize_nfc($fb_reg_data['registration']['username']),
    'email'			=> strtolower($fb_reg_data['registration']['email']),
    'email_confirm'		=> strtolower($fb_reg_data['registration']['email']),
    'lang'                      => basename(request_var('lang', $user->lang_name)),
    'tz'			=> request_var('tz', (float) $timezone),
);

$validate_username = validate_username($data['username']);

if($validate_username)
{
    trigger_error($user->lang[$validate_username . '_USERNAME'] . ' <br /><br /><a href="' . $phpbb_root_path . '/alternatelogin/al_fb_registration.' . $phpEx . '?mode=register">' . $user->lang['BACK_TO_PREV'] . "</a>");            
}

if($config['al_require_password'])
{
    $new_password = $fb_reg_data['registration']['password'];
}
else
{
    $new_password = substr(md5($fb_user . $config['al_fb_key'] . $config['al_fb_secret']), 0, $config['max_pass_chars']);
}
$data['new_password'] = $new_password;
$data['password_confirm'] = $new_password;

$error = validate_data($data, array(
    'username'			=> array(
                                        array('string', false, $config['min_name_chars'], $config['max_name_chars']),
                                        array('username', '')),
    'new_password'		=> array(
                                        array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
                                        array('password')),
    'password_confirm'          => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']),
    'email'                     => array(
                                        array('string', false, 6, 60),
                                        array('email')),
    'email_confirm'		=> array('string', false, 6, 60),
    'tz'			=> array('num', false, -14, 14),
    'lang'			=> array('match', false, '#^[a-z_\-]{2,}$#i'),
));



// DNSBL check
if ($config['check_dnsbl'])
{
    if (($dnsbl = $user->check_dnsbl('register')) !== false)
    {
        $error[] = sprintf($user->lang['IP_BLACKLISTED'], $user->ip, $dnsbl[1]);
    }
}

if (!sizeof($error))
{
    if ($data['new_password'] != $data['password_confirm'])
    {
        $error[] = $user->lang['NEW_PASSWORD_ERROR'];
    }

    if ($data['email'] != $data['email_confirm'])
    {
        $error[] = $user->lang['NEW_EMAIL_ERROR'];
    }
}

if (!sizeof($error))
{
    $server_url = generate_board_url();

    // Which group by default?
    $group_name = ($coppa) ? 'REGISTERED_COPPA' : 'REGISTERED';

    $sql = 'SELECT group_id
            FROM ' . GROUPS_TABLE . "
            WHERE group_name = '" . $db->sql_escape($group_name) . "'
                    AND group_type = " . GROUP_SPECIAL;
    $result = $db->sql_query($sql);
    $row = $db->sql_fetchrow($result);
    $db->sql_freeresult($result);

    if (!$row)
    {
        trigger_error('NO_GROUP');
    }

    $group_id = $row['group_id'];

    if (($coppa ||
            $config['require_activation'] == USER_ACTIVATION_SELF ||
            $config['require_activation'] == USER_ACTIVATION_ADMIN) && $config['email_enable'])
    {
        $user_actkey = gen_rand_string(10);
        $key_len = 54 - (strlen($server_url));
        $key_len = ($key_len < 6) ? 6 : $key_len;
        $user_actkey = substr($user_actkey, 0, $key_len);

        $user_type = USER_INACTIVE;
        $user_inactive_reason = INACTIVE_REGISTER;
        $user_inactive_time = time();
    }
    else
    {
        $user_type = USER_NORMAL;
        $user_actkey = '';
        $user_inactive_reason = 0;
        $user_inactive_time = 0;
    }

    $user_row = array(
        'username'				=> $data['username'],
        'user_password'			=> phpbb_hash($data['new_password']),
        'user_email'			=> $data['email'],
        'group_id'				=> (int) $group_id,
        'user_timezone'			=> (float) $data['tz'],
        'user_dst'				=> $is_dst,
        'user_lang'				=> $data['lang'],
        'user_type'				=> $user_type,
        'user_actkey'			=> $user_actkey,
        'user_ip'				=> $user->ip,
        'user_regdate'			=> time(),
        'user_inactive_reason'	=> $user_inactive_reason,
        'user_inactive_time'	=> $user_inactive_time,
        'al_fb_id'              => $fb_user,
    );

    if ($config['new_member_post_limit'])
    {
        $user_row['user_new'] = 1;
    }

    // Register user...
    $user_id = user_add($user_row, $cp_data);

    // This should not happen, because the required variables are listed above...
    if ($user_id === false)
    {
        trigger_error('NO_USER', E_USER_ERROR);
    }
    

    // DB Error
    if(!$result)
    {
            trigger_error('Unable to connect with phpBB database.');
    }

    $al_email_lang = $user->lang['FACEBOOK'];

    if ($coppa && $config['email_enable'])
    {
        $message = $user->lang['ACCOUNT_COPPA'];
        if($al_login)
        {
                $email_template = 'coppa_welcome_inactive_alternatelogin';
        }
        else
        {
                $email_template = 'coppa_welcome_inactive';
        }
    }
    else if ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable'])
    {
        $message = $user->lang['ACCOUNT_INACTIVE'];
        if($al_login)
        {
                $email_template = 'user_welcome_inactive_alternatelogin';
        }
        else
        {
                $email_template = 'user_welcome_inactive';
        }
    }
    else if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $config['email_enable'])
    {
        $message = $user->lang['ACCOUNT_INACTIVE_ADMIN'];
        if($al_login)
        {
                $email_template = 'admin_welcome_inactive_alternatelogin';
        }
        else
        {
                $email_template = 'admin_welcome_inactive';
        }
    }
    else
    {
        $message = $user->lang['ACCOUNT_ADDED'];
        if($al_login)
        {
                $email_template = 'user_welcome_alternatelogin';
        }
        else
        {
                $email_template = 'user_welcome';
        }
    }

    if ($config['email_enable'])
    {
            include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);

            $messenger = new messenger(false);

            $messenger->template($email_template, $data['lang']);

            $messenger->to($data['email'], $data['username']);

            $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
            $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
            $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
            $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);

            $messenger->assign_vars(array(
                    'WELCOME_MSG'	=> htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])),
                    'USERNAME'		=> htmlspecialchars_decode($data['username']),
                    'PASSWORD'		=> htmlspecialchars_decode($data['new_password']),
                    'AL_LOGIN_TYPE'		=> $al_email_lang,
                    'U_ACTIVATE'	=> "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
            );

            if ($coppa)
            {
                    $messenger->assign_vars(array(
                            'FAX_INFO'		=> $config['coppa_fax'],
                            'MAIL_INFO'		=> $config['coppa_mail'],
                            'EMAIL_ADDRESS'	=> $data['email'])
                    );
            }

            $messenger->send(NOTIFY_EMAIL);

            if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
            {
                    // Grab an array of user_id's with a_user permissions ... these users can activate a user
                    $admin_ary = $auth->acl_get_list(false, 'a_user', false);
                    $admin_ary = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array();

                    // Also include founders
                    $where_sql = ' WHERE user_type = ' . USER_FOUNDER;

                    if (sizeof($admin_ary))
                    {
                            $where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary);
                    }

                    $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
                            FROM ' . USERS_TABLE . ' ' .
                            $where_sql;
                    $result = $db->sql_query($sql);

                    while ($row = $db->sql_fetchrow($result))
                    {
                            $messenger->template('admin_activate', $row['user_lang']);
                            $messenger->to($row['user_email'], $row['username']);
                            $messenger->im($row['user_jabber'], $row['username']);

                            $messenger->assign_vars(array(
                                    'USERNAME'			=> htmlspecialchars_decode($data['username']),
                                    'U_USER_DETAILS'	=> "$server_url/memberlist.$phpEx?mode=viewprofile&u=$user_id",
                                    'U_ACTIVATE'		=> "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey")
                            );

                            $messenger->send($row['user_notify_type']);
                    }
                    $db->sql_freeresult($result);
            }
    }
    
    if(sizeof($error))
    {
        $message = '';
        foreach($error as $e)
        {
            $message .= $user->lang[$e] . '<br />';
        }
        
        trigger_error($message);
    }
    
    $message = $message . '<br /><br />' . sprintf($user->lang['PREV_PAGE'], '<a href="' . append_sid("{$phpbb_root_path}alternatelogin/al_fb_registration.$phpEx") . '">', '</a>');

    $message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
    trigger_error($message);
}
?>
I hope this changes will be included in the next release! :)
Not to worry, those changes are already in place. I am just finishing off fixing an error in the ucp page with the linking and unlinking of existing accounts and then I will be able to release the next version.

Many thanks though!
Questions answered via forums only, no pms or emails. Thank you.

ConSof Alternate Login for phpBB

Image Image

User avatar
Mrtb
Registered User
Posts: 111
Joined: Sat Jun 02, 2007 6:12 pm
Location: Ancona, Italy

Re: [BETA]AlternateLogin(Windows Live,Facebook,Twitter)

Post by Mrtb »

Another problem: users that need to be activated by the admin don't see, after the registration, the message: 'Your account has been created. However, this board requires account activation by the administrator group. An e-mail has been sent to them and you will be informed when your account has been activated.' ('ACCOUNT_INACTIVE_ADMIN') and when they try to log in they don't see the message: "The specified username is inactive " ('ACTIVE_ERROR') but they see the message LOGIN_SUCCESS.

mikymoon
Registered User
Posts: 27
Joined: Mon Mar 29, 2004 6:36 am

Re: [BETA]AlternateLogin(Windows Live,Facebook,Twitter)

Post by mikymoon »

Mrtb wrote:I personally fixed some bug I found in this MOD:

1. "Unknown column 'al_oi_id' in 'field list' [1054]": You're already fixed it by changing the sql queries from "al_oi_id" to "al_tw_id" in functions_alternatelogin.php and al_fb_connect.php files.

2. Users can't login into ACP page if they need to set their own password and if they didn't: You need to replace the functions_alternatelogin.php and al_fb_register.php files with the below ones

3. Once you logged in ACP you didn't see the default message "You have successfully authenticated and will now be redirected to the Administration Control Panel.": replace the functions_alternatelogin.php file with the below ones
Hi, i made this changes and i get this error when i try to conect to facbook:Unknown algorithm. Expected HMAC-SHA256

thanks

User avatar
Mrtb
Registered User
Posts: 111
Joined: Sat Jun 02, 2007 6:12 pm
Location: Ancona, Italy

Re: [BETA]AlternateLogin(Windows Live,Facebook,Twitter)

Post by Mrtb »

Ok, you need also to make a better localization: you should replace LOGIN_FAILURE (al_fb_connect.php) with LOGOUT_REDIRECT and LOGIN_REDIRECT (al_fb_connect.php) with LOGIN_REDIRECT. You should also set the correct redirect when a user logs in or logs out.

Then, I uploaded a wrong file last time (functions_alternatelogin.php) because there was a problem with user login into the ACP... so this is the new file:

functions_alternatelogin.php

Code: Select all

<?php
/*
	COPYRIGHT 2009 Michael J Goonawardena

	This file is part of ConSof Alternate Login.

    ConSof Alternate Login is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    ConSof Alternate Login is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with ConSof Alternate Login.  If not, see <http://www.gnu.org/licenses/>.*/
if (!defined('IN_PHPBB'))
{
	exit;
}

define('AL_FACEBOOK_LOGIN', 0);
define('AL_MYSPACE_LOGIN', 2);
define('AL_MYSPACE_PROFILE', 3);
define('AL_GOOGLE_LOGIN', 4);
define('AL_GOOGLE_PROFILE', 5);
define('AL_TWITTER_LOGIN', 6);
define('AL_TWITTER_PROFILE', 7);
define('AL_WINDOWSLIVE_LOGIN', 8);
define('AL_WINDOWSLIVE_PROFILE', 9);

define('AL_FB_SYNC_PROFILE', 1);
define('AL_FB_SYNC_AVATAR', 11);
define('AL_FB_SYNC_STATUS', 12);

define('AL_HIDE_POST_LOGON', 10);	// Does the user want to be asked if they want to see the 'hide online' and autologin screen after verification?

define('AL_USER_OPTION_COUNT', 13);

define('WL_COOKIE', 'webauthtoken');
define('PCOOKIE', time() + (10 * 365 * 24 * 60 * 60));

define('HTTP_GET', 0);
define('HTTP_POST', 1);



/**
* Validate an Alternate Login ID for Admin privaleges..
*
* @return False if the login failed, True if success.
*/
function al_validate_admin()
{
	global $template, $db, $config, $user, $auth, $phpEx, $phpbb_root_path;

	$user->add_lang('acp/common');

	$sql = "SELECT user_password, user_email, user_allow_viewonline, al_fb_id, al_wl_id, al_tw_id" .
			" FROM " . USERS_TABLE .
			" WHERE " . USERS_TABLE . ".user_id='" . $user->data['user_id'] . "'";

	$result = $db->sql_query($sql);

	$row = $db->sql_fetchrow($result);

	$username = $user->data['username'];
	$storedpass = $user->data['user_password'];
	$password = '';

	if($row)
	{
		if($row['al_fb_id'] != NULL)
		{
			$password = substr(md5($user->data['al_fb_id'] . $config['al_fb_key'] . $config['al_fb_secret']), 0, $config['max_pass_chars']);
		}
		elseif($row['al_wl_id'] != NULL)
		{
			$password = substr($row['al_wl_id'], 0, $config['max_pass_chars']);
		}
		elseif($row['al_tw_id'] != NULL)
		{
			$password = substr($row['al_tw_id'], 0, $config['max_pass_chars']);
		}

		$hide_online = $row['user_allow_viewonline'];

		if (!phpbb_check_hash($password,$storedpass))
		{
		  login_box('', $user->lang['LOGIN_ADMIN_CONFIRM'], $user->lang['LOGIN_ADMIN_SUCCESS'], true, false);
    }
    else
    {
		  $result = $auth->login($username, $password, false, $hide_online, true);
		}


		if($result['status'] == LOGIN_SUCCESS)
		{
			add_log('admin', 'LOG_ADMIN_AUTH_SUCCESS');

			$redirect = "{$phpbb_root_path}adm/index.$phpEx";
			$message = $user->lang['LOGIN_ADMIN_SUCCESS'];
			$l_redirect = $user->lang['PROCEED_TO_ACP'];

			// append/replace SID (may change during the session for AOL users)
			$redirect = reapply_sid($redirect);

			// Special case... the user is effectively banned, but we allow founders to login
			if (defined('IN_CHECK_BAN') && $result['user_row']['user_type'] != USER_FOUNDER)
			{
				return;
			}

			$redirect = meta_refresh(3, $redirect);
			trigger_error($message . '<br /><br />' . sprintf($l_redirect, '<a href="' . $redirect . '">', '</a>'));

		}
		else
		{
			if ($user->data['is_registered'])
			{
				add_log('admin', 'LOG_ADMIN_AUTH_FAIL');
			}
			// Something failed, determine what...
			if ($result['status'] == LOGIN_BREAK)
			{
				trigger_error($result['error_msg']);
			}

			// Special cases... determine
			switch ($result['status'])
			{
				case LOGIN_ERROR_ATTEMPTS:

					// Show confirm image
					$sql = 'DELETE FROM ' . CONFIRM_TABLE . "
						WHERE session_id = '" . $db->sql_escape($user->session_id) . "'
							AND confirm_type = " . CONFIRM_LOGIN;
					$db->sql_query($sql);

					// Generate code
					$code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS));
					$confirm_id = md5(unique_id($user->ip));
					$seed = hexdec(substr(unique_id(), 4, 10));

					// compute $seed % 0x7fffffff
					$seed -= 0x7fffffff * floor($seed / 0x7fffffff);

					$sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array(
						'confirm_id'	=> (string) $confirm_id,
						'session_id'	=> (string) $user->session_id,
						'confirm_type'	=> (int) CONFIRM_LOGIN,
						'code'			=> (string) $code,
						'seed'			=> (int) $seed)
					);
					$db->sql_query($sql);

					$template->assign_vars(array(
						'S_CONFIRM_CODE'			=> true,
						'CONFIRM_ID'				=> $confirm_id,
						'CONFIRM_IMAGE'				=> '<img src="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=confirm&id=' . $confirm_id . '&type=' . CONFIRM_LOGIN) . '" alt="" title="" />',
						'L_LOGIN_CONFIRM_EXPLAIN'	=> sprintf($user->lang['LOGIN_CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'),
					));

					$err = $user->lang[$result['error_msg']];

				break;

				case LOGIN_ERROR_PASSWORD_CONVERT:
					$err = sprintf(
						$user->lang[$result['error_msg']],
						($config['email_enable']) ? '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') . '">' : '',
						($config['email_enable']) ? '</a>' : '',
						($config['board_contact']) ? '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">' : '',
						($config['board_contact']) ? '</a>' : ''
					);
				break;

				// Username, password, etc...
				default:
					$err = $user->lang[$result['error_msg']];

					// Assign admin contact to some error messages
					if ($result['error_msg'] == 'LOGIN_ERROR_USERNAME' || $result['error_msg'] == 'LOGIN_ERROR_PASSWORD')
					{
						$err = (!$config['board_contact']) ? sprintf($user->lang[$result['error_msg']], '', '') : sprintf($user->lang[$result['error_msg']], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>');
					}

				break;
			}
			trigger_error($err);
		}
	}
}

function get_wl_tokens($cid, $authorization_code, $refresh_token)
{
    global $config, $user;

    $url = "https://oauth.live.com/token?";
    $url .= "client_id={$config['al_wl_client_id']}";
    $url .= "&redirect_uri=" . urlencode($config['al_wl_callback']);
    $url .= "&client_secret={$config['al_wl_secret']}";
    if($authorization_code)
    {
        $url .= "&code={$authorization_code}";
        $url .= "&grant_type=authorization_code";
    }
    elseif($refresh_token)
    {
        $url .= "&refresh_token={$refresh_token}";
        $url .= "&grant_type=refresh_token";
    }
    else
    {
        trigger_error($user->lang['MISSING_AUTH_OR_REFRESH']);
    }

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);


    $data = curl_exec($ch);

    if(curl_errno($ch))
    {
        trigger_error($user->lang['ERROR_RETRIEVING_TOKENS']);
    }

    curl_close($ch);

    $data_decoded = json_decode($data);


    if($data_decoded->error)
    {
        trigger_error($data_decoded->error);
    }

    return $data_decoded;
}

function get_wl_rest_request($access_token, $path, $method = HTTP_GET, $headers = NULL, $method_data = NULL)
{
    $url = "https://apis.live.net/v5.0/{$path}/?access_token={$access_token}";

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    if($method == HTTP_GET)
    {
        curl_setopt($ch, CURLOPT_HTTPGET, true);
    }
    elseif($method == HTTP_POST)
    {
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $method_data);
    }
    else
    {
        trigger_error($user->lang['ERROR_UNDETERMINED_HTTP_METHOD']);
    }

    $data = curl_exec($ch);

    if(curl_errno($ch))
    {
        return false;
    }

    curl_close($ch);

    return json_decode($data);
}



function get_fb_access_token()
{
    global $config, $db, $user;
    $my_url = generate_board_url() . "/alternatelogin/al_fb_connect.php";

    $code = $_REQUEST["code"];

    if(empty($code)) {
        $dialog_url = "http://www.facebook.com/dialog/oauth?client_id="
            . $config['al_fb_id'] . "&redirect_uri=" . urlencode($my_url) . "&scope=user_location,user_activities,user_birthday,user_interests,user_status,user_website,user_work_history";

        echo("<script> top.location.href='" . $dialog_url . "'</script>");
    }

    $token_url = "https://graph.facebook.com/oauth/access_token?client_id="
        . $config['al_fb_id'] . "&redirect_uri=" . urlencode($my_url) . "&client_secret="
        . $config['al_fb_secret'] . "&code=" . $code;

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $token_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($ch, CURLOPT_HTTPGET, true);


    $access_token = curl_exec($ch);

    if(curl_errno($ch))
    {
        return false;
    }

    curl_close($ch);

    //$access_token = file_get_contents($token_url);

    return $access_token;
}

function get_fb_data($url)
{
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($ch, CURLOPT_HTTPGET, true);


    $data = curl_exec($ch);

    if(curl_errno($ch))
    {
        return false;
    }

    curl_close($ch);

    return $data;
}
?>
Another issue... You needs to remove the spaces in facebook_registration.html and localize the username string.

facebook_registration.html

Code: Select all

<!-- INCLUDE overall_header.html -->

<script src="http://connect.facebook.net/en_US/all.js#appId={S_FB_APP_ID}&xfbml=1"></script>

      </script>
      <script>
         FB.init({
            appId:'{S_FB_APP_ID}',
            cookie:true,
            status:true,
            xfbml:true
         });
      </script>
<fb:registration
  fields="[
            {'name':'name'},
            {'name':'username', 'description':'Please enter a unique username for this site', 'type':'text'},
            {'name':'birthday'},{'name':'gender'},
            {'name':'location'},{'name':'email'},
            <!-- IF S_REQUIRE_PASSWORD -->{'name':'password'}<!-- ENDIF -->
          ]"
  redirect-uri="{S_REDIRECT_URI}"
  width="530">
</fb:registration>
<!-- INCLUDE overall_footer.html -->
And the last feature I'd like to see in the next release is the localization of the facebook connect scripts. For example on facebook_registration.html the script used by the file is "http://connect.facebook.net/en_US/all.js" so in italian boards should be "http://connect.facebook.net/it_IT/all.js". I also think I'll upload you the italian traslation for this MOD by the next days.

I hope this little fixes will help you to improve this very usefull MOD. Thank you.

gazzerman
Registered User
Posts: 3
Joined: Fri Aug 26, 2011 11:51 pm

Re: [BETA]AlternateLogin(Windows Live,Facebook,OpenID)

Post by gazzerman »

mjimeyg wrote:
Tom wrote:
gazzerman wrote:
funny5293 wrote:Ah well your MOD works well. But i have few problems..
How can i remove the page which says-
Confirm
Do you wish to register with your Facebook account?
Yes No

I want it to automatically go for yes. So how to remove this page.
Very quick and easy, go to the file "/alternatelogin/al_fb_connect.php"

then remove the following code.

Line 174/175: if(confirm_box(true)){

Line 234-240:
}
else
{
confirm_box(false, sprintf($user->lang['AL_REGISTER_QUERY'], $user->lang['FACEBOOK']));
// They said no so send them to the home page.
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
}



This will remove the confirm section and move right onto the terms agreement.

Hope that helps everyone?
Doing as you instructed, the confirmation window will still be displayed to the user, but regardless of whether they choose "Yes" or "No" it will assume that the user wants to register with their Facebook account. Therefore, performing your modifications would not actually result in the desired effect of completely removing the confirmation screen from registration, it will just treat every user as if they chose "Yes" at that screen even if they chose "No".
I checked the code, and it works fine as gazzerman wrote. The confirmation is removed.

It's a simple code change but not one that will find it's way into the final version as most users will want to be asked before being sent straight to a terms/agreement page with no explanation.
Ok I was just playing with the code and this is what I have done.

I removed all code between
if($user->data['user_id'] == ANONYMOUS)
{
AND
}
else
{
// If they are not anonymous then we can assume they are current users wishing
// to link their accounts.


With this:

$passgetdata = "&al_login=1&al_login_type=AL_FACEBOOK_LOGIN&al_fb_user=" . $fb_user->id;

redirect(append_sid("{$phpbb_root_path}alternatelogin/al_fb_registration.$phpEx", 'mode=register' . $passgetdata . $add_lang));


This results in the users data being automatically passed via a GET rather than a POST in a form, but if you have "coppa" as an option then it will cause a problem as it will bypass it.

This is a bit of a hack but it does exactly what i want it to do and may do the same for others. Can anyone see any security risks in passing the data in GET rather than POST? if so is there a solution?

User avatar
Mrtb
Registered User
Posts: 111
Joined: Sat Jun 02, 2007 6:12 pm
Location: Ancona, Italy

Re: [BETA]AlternateLogin(Windows Live,Facebook,Twitter)

Post by Mrtb »

with the new version 2011.10.03.02 login doesn't work anymore.

User avatar
mjimeyg
Registered User
Posts: 840
Joined: Sat Aug 29, 2009 7:38 pm
Location: London

Re: [BETA]AlternateLogin(Windows Live,Facebook,Twitter)

Post by mjimeyg »

mikymoon wrote:
Mrtb wrote:I personally fixed some bug I found in this MOD:

1. "Unknown column 'al_oi_id' in 'field list' [1054]": You're already fixed it by changing the sql queries from "al_oi_id" to "al_tw_id" in functions_alternatelogin.php and al_fb_connect.php files.

2. Users can't login into ACP page if they need to set their own password and if they didn't: You need to replace the functions_alternatelogin.php and al_fb_register.php files with the below ones

3. Once you logged in ACP you didn't see the default message "You have successfully authenticated and will now be redirected to the Administration Control Panel.": replace the functions_alternatelogin.php file with the below ones
Hi, i made this changes and i get this error when i try to conect to facbook:Unknown algorithm. Expected HMAC-SHA256

thanks

I have been searching for an answer to this but there doesn't seem to be one. This usually suggests the only thing you can do is check your Facebook App settings.
Questions answered via forums only, no pms or emails. Thank you.

ConSof Alternate Login for phpBB

Image Image

User avatar
mjimeyg
Registered User
Posts: 840
Joined: Sat Aug 29, 2009 7:38 pm
Location: London

Re: [BETA]AlternateLogin(Windows Live,Facebook,Twitter)

Post by mjimeyg »

Mrtb wrote:with the new version 2011.10.03.02 login doesn't work anymore.
Can you be more specific, everything works fine for me.
Questions answered via forums only, no pms or emails. Thank you.

ConSof Alternate Login for phpBB

Image Image

User avatar
Mrtb
Registered User
Posts: 111
Joined: Sat Jun 02, 2007 6:12 pm
Location: Ancona, Italy

Re: [BETA]AlternateLogin(Windows Live,Facebook,Twitter)

Post by Mrtb »

Ok, you need also to make a better localization: you should replace LOGIN_FAILURE (al_fb_connect.php) with LOGOUT_REDIRECT and LOGIN_REDIRECT (al_fb_connect.php) with LOGIN_REDIRECT. You should also set the correct redirect when a user logs in or logs out.
1. These bugs have'nt been fixed yet...
Another issue... You needs to remove the spaces in facebook_registration.html and localize the username string.
2.These too. You need to fix these because in other facebook connect locales fb registration doesn't work properly (an error appears)

Now, the new version bugs:
a.If you set "Require Password" on Consof ACP to "yes" and the user chose his own password he won't be able to login in any case.
b.If you set "Require Password" to "no" you won't be able to login if you have already tried to login using the old login box in the index page for more than 3 times (some users do that instead of using the Facebook connect button and then they won't login anymore...)
c. With the old version (and with this one, changing the user_login_attempts field to 3 after the login) you won't be able to login to the ACP because the confirm image isn't shown.

_mayhem_
Registered User
Posts: 53
Joined: Fri Apr 18, 2008 9:17 pm
Location: Turkey - istanbul
Name: Unsal ASLANBAS
Contact:

Re: [BETA]AlternateLogin(Windows Live,Facebook,Twitter)

Post by _mayhem_ »

facebook goog work. ;)

twitter Callback URL: ????? :?: :?
http://uabnet.com ==)) Turkish Board.

User avatar
mjimeyg
Registered User
Posts: 840
Joined: Sat Aug 29, 2009 7:38 pm
Location: London

Re: [BETA]AlternateLogin(Windows Live,Facebook,Twitter)

Post by mjimeyg »

_mayhem_ wrote:facebook goog work. ;)

twitter Callback URL: ????? :?: :?
The callback url will be:

http://www.example.com/phpbb3/alternate ... onnect.php

Or whatever url points to your al_tw_connect.php file.
Questions answered via forums only, no pms or emails. Thank you.

ConSof Alternate Login for phpBB

Image Image

Locked

Return to “[3.0.x] Abandoned MODs”