1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 08:47:45 +02:00

[feature/oauth] Changes due to code review

PHPBB3-11673
This commit is contained in:
Joseph Warner
2013-08-24 22:00:16 -04:00
parent 310caec5d9
commit a8ffbce99f
10 changed files with 62 additions and 67 deletions

View File

@@ -17,8 +17,17 @@ if (!defined('IN_PHPBB'))
class ucp_auth_link
{
/**
* @var string
*/
public $u_action;
/**
* Generates the ucp_auth_link page and handles the auth link process
*
* @param int $id
* @param string $mode
*/
public function main($id, $mode)
{
global $config, $request, $template, $phpbb_container, $user;
@@ -72,7 +81,7 @@ class ucp_auth_link
}
}
// In some cases, an request to an external server may be required in
// In some cases, a request to an external server may be required. In
// these cases, the GET parameter 'link' should exist and should be true
if ($request->variable('link', false))
{
@@ -114,8 +123,11 @@ class ucp_auth_link
$s_hidden_fields = build_hidden_fields($s_hidden_fields);
// Replace "error" strings with their real, localised form
$error = array_map(array($user, 'lang'), $error);
$template->assign_vars(array(
'ERROR' => $this->build_error_text($error),
'ERROR' => $error,
'PROVIDER_TEMPLATE_FILE' => $provider_data['TEMPLATE_FILE'],
@@ -126,20 +138,4 @@ class ucp_auth_link
$this->tpl_name = 'ucp_auth_link';
$this->page_title = 'UCP_AUTH_LINK';
}
private function build_error_text(array $errors)
{
global $user;
// Replace all errors that are language constants
foreach ($errors as $key => $error)
{
if (isset($user->lang[$error]))
{
$errors[$key] = $user->lang($error);
}
}
return implode('<br />', $errors);
}
}

View File

@@ -91,7 +91,9 @@ class ucp_login_link
if ($result)
{
$login_link_error = $user->lang[$result];
} else {
}
else
{
// Finish login
$result = $user->session_create($login_result['user_row']['user_id'], false, false, true);