From 4030000b34f8e71ff8bd5419454f0e28dcc59b1e Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sat, 21 Dec 2019 22:24:19 +0000 Subject: [PATCH] #687 Add an option to set main page after logging in --- lib/App/Netdisco/Web/AuthN.pm | 4 ++-- share/config.yml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/App/Netdisco/Web/AuthN.pm b/lib/App/Netdisco/Web/AuthN.pm index 660ee54e..44ee6bc2 100644 --- a/lib/App/Netdisco/Web/AuthN.pm +++ b/lib/App/Netdisco/Web/AuthN.pm @@ -15,7 +15,7 @@ sub request_is_api { hook 'before' => sub { params->{return_url} ||= ((request->path ne uri_for('/')->path) - ? request->uri : uri_for('/inventory')->path); + ? request->uri : uri_for(setting('web_home'))->path); # from the internals of Dancer::Plugin::Auth::Extensible my $provider = Dancer::Plugin::Auth::Extensible::auth_provider('users'); @@ -191,7 +191,7 @@ get '/logout' => sub { return to_json {}; } - redirect uri_for('/inventory')->path; + redirect uri_for(setting('web_home'))->path; }; true; diff --git a/share/config.yml b/share/config.yml index 8420d0b1..30afc116 100644 --- a/share/config.yml +++ b/share/config.yml @@ -39,6 +39,7 @@ api_token_lifetime: 3600 # debug: 3 # tls_opts: {} path: '/' +web_home: '/inventory' web_plugins: - Inventory - Report::PortVLANMismatch