mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 14:00:31 +02:00
Merge pull request #2104 from nickvergessen/ticket/12261
[ticket/12261] Remove web root path from login redirect url
This commit is contained in:
@@ -14,6 +14,10 @@ foo_exception_controller:
|
||||
pattern: /foo/exception
|
||||
defaults: { _controller: foo_bar.controller:exception }
|
||||
|
||||
foo_login_redirect_controller:
|
||||
pattern: /foo/login_redirect
|
||||
defaults: { _controller: foo_bar.controller:login_redirect }
|
||||
|
||||
foo_redirect_controller:
|
||||
pattern: /foo/redirect
|
||||
defaults: { _controller: foo_bar.controller:redirect }
|
||||
|
@@ -6,6 +6,7 @@ services:
|
||||
- @path_helper
|
||||
- @template
|
||||
- @config
|
||||
- @user
|
||||
- %core.root_path%
|
||||
- %core.php_ext%
|
||||
|
||||
|
@@ -10,13 +10,15 @@ class controller
|
||||
protected $helper;
|
||||
protected $path_helper;
|
||||
protected $config;
|
||||
protected $user;
|
||||
|
||||
public function __construct(\phpbb\controller\helper $helper, \phpbb\path_helper $path_helper, \phpbb\template\template $template, \phpbb\config\config $config, $root_path, $php_ext)
|
||||
public function __construct(\phpbb\controller\helper $helper, \phpbb\path_helper $path_helper, \phpbb\template\template $template, \phpbb\config\config $config, \phpbb\user $user, $root_path, $php_ext)
|
||||
{
|
||||
$this->template = $template;
|
||||
$this->helper = $helper;
|
||||
$this->path_helper = $path_helper;
|
||||
$this->config = $config;
|
||||
$this->user = $user;
|
||||
$this->root_path = $root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
}
|
||||
@@ -43,6 +45,18 @@ class controller
|
||||
throw new \phpbb\controller\exception('Exception thrown from foo/exception route');
|
||||
}
|
||||
|
||||
public function login_redirect()
|
||||
{
|
||||
if (!$this->user->data['is_registered'])
|
||||
{
|
||||
login_box();
|
||||
}
|
||||
|
||||
$this->template->assign_var('A_VARIABLE', 'I am a variable');
|
||||
|
||||
return $this->helper->render('foo_bar_body.html');
|
||||
}
|
||||
|
||||
public function redirect()
|
||||
{
|
||||
$url_root = generate_board_url();
|
||||
|
Reference in New Issue
Block a user