diff options
author | Joseph Warner <hardolaf@hardolaf.com> | 2013-08-12 12:53:10 -0400 |
---|---|---|
committer | Joseph Warner <hardolaf@hardolaf.com> | 2013-08-12 12:53:22 -0400 |
commit | a479f919ff17bc96e55baf8c4b811ac4ec22d8f1 (patch) | |
tree | de883adf1860f83e7104e3567301c0b2bdbe4b58 /phpBB/includes/ucp/ucp_auth_link.php | |
parent | 69cb2e4c603243f75fcfd288d0018390b763ce05 (diff) | |
download | forums-a479f919ff17bc96e55baf8c4b811ac4ec22d8f1.tar forums-a479f919ff17bc96e55baf8c4b811ac4ec22d8f1.tar.gz forums-a479f919ff17bc96e55baf8c4b811ac4ec22d8f1.tar.bz2 forums-a479f919ff17bc96e55baf8c4b811ac4ec22d8f1.tar.xz forums-a479f919ff17bc96e55baf8c4b811ac4ec22d8f1.zip |
[feature/oauth] Error handling on page
PHPBB3-11673
Diffstat (limited to 'phpBB/includes/ucp/ucp_auth_link.php')
-rw-r--r-- | phpBB/includes/ucp/ucp_auth_link.php | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/phpBB/includes/ucp/ucp_auth_link.php b/phpBB/includes/ucp/ucp_auth_link.php index cb6d85d6b7..cf92b5d58d 100644 --- a/phpBB/includes/ucp/ucp_auth_link.php +++ b/phpBB/includes/ucp/ucp_auth_link.php @@ -23,23 +23,23 @@ class ucp_auth_link { global $config, $request, $template, $phpbb_container; + $error = array(); + $auth_provider = $phpbb_container->get('auth.provider.' . $config['auth_method']); // confirm that the auth provider supports this page $provider_data = $auth_provider->get_auth_link_data(); if ($provider_data === null) { - // does not support this page, throw error? - throw new Exception('TEMPORARY EXCEPTION'); + $error[] = 'UCP_AUTH_LINK_NOT_SUPPORTED'; } - $error = array(); $s_hidden_fields = array(); add_form_key('ucp_auth_link'); $submit = $request->variable('submit', false, false, phpbb_request_interface::POST); - if ($submit) + if (!sizeof($error) && $submit) { if (!check_form_key('ucp_reg_details')) { @@ -55,6 +55,8 @@ class ucp_auth_link $s_hidden_fields = build_hidden_fields($s_hidden_fields); $template->assign_vars(array( + 'ERROR' => $this->build_error_text($error), + 'PROVIDER_TEMPLATE_FILE' => $provider_data['TEMPLATE_FILE'], 'S_HIDDEN_FIELDS' => $s_hidden_fields, @@ -64,4 +66,20 @@ 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); + } } |