Skip to content

Commit

Permalink
Pass redirect_url through setup form
Browse files Browse the repository at this point in the history
When accessing a 'not set up' Nextcloud with a redirect_url parameter
the parameter will is added to the setup POST request, resulting in the
requested redirect after setup is complete.

This is required in scenarios where Nextcloud is used as authorization
provider like on the Spreedbox to allow redirection to the required page
when normally a login form would be shown but the setup form is shown
instead.
  • Loading branch information
longsleep committed Sep 13, 2016
1 parent 0543661 commit 1a240a2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/js/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ $(document).ready(function() {
form.append(input);
}

// Add redirect_url
var redirectURL = getURLParameter('redirect_url');
if (redirectURL) {
var redirectURLInput = $('<input type="hidden">');
redirectURLInput.attr({
name: 'redirect_url',
value: redirectURL
});
form.append(redirectURLInput);
}

// Submit the form
form.appendTo(document.body);
form.submit();
Expand Down

0 comments on commit 1a240a2

Please sign in to comment.