Fix error handling when no client_id is given

Change-Id: I6e9a7b5028fc538b6d45375e5bd5858b978ad1a6
diff --git a/lib/Kalamar/Plugin/Auth.pm b/lib/Kalamar/Plugin/Auth.pm
index 5081ef8..ec83b02 100644
--- a/lib/Kalamar/Plugin/Auth.pm
+++ b/lib/Kalamar/Plugin/Auth.pm
@@ -1103,7 +1103,7 @@
         # Redirect with error
         if ($v->has_error) {
           $c->notify(error => $c->loc('Auth_paramError'));
-          return $c->redirect_to;
+          return $c->redirect_to('oauth-settings');
         };
 
         foreach (qw!scope client_id state redirect_uri!) {
@@ -1176,7 +1176,7 @@
 
         # Render with error
         if ($v->has_error) {
-          my $url = Mojo::URL->new($v->param('redirect_uri_server') // $c->url_for('index'));
+          my $url = Mojo::URL->new($v->param('redirect_uri_server') || $c->url_for('index'));
 
           if ($v->has_error('csrf_token')) {
             $url->query([error_description => $c->loc('Auth_csrfFail')]);
diff --git a/t/plugin/auth-oauth.t b/t/plugin/auth-oauth.t
index 53358e8..63c1df2 100644
--- a/t/plugin/auth-oauth.t
+++ b/t/plugin/auth-oauth.t
@@ -765,7 +765,11 @@
 # OAuth client authorization flow
 $t->get_ok(Mojo::URL->new('/settings/oauth/authorize'))
   ->status_is(302)
-  ->header_is('location','/settings/oauth/authorize')
+  ->header_is('location','/settings/oauth')
+  ;
+
+$t->get_ok('/settings/oauth/')
+  ->text_is('div.notify-error', 'Some fields are invalid')
   ;
 
 # Logout