aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-02-28 17:05:55 +0100
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-02-28 17:05:55 +0100
commitfb890807c0c17549566690512549c8d4ae5813e3 (patch)
tree7901fbfd00a750f05a67b51c8f29030327ca45b0 /apps/files_sharing
parent0cfdf4748f248e1b55fc459a05e7782a1e585716 (diff)
downloadnextcloud-server-fb890807c0c17549566690512549c8d4ae5813e3.tar.gz
nextcloud-server-fb890807c0c17549566690512549c8d4ae5813e3.zip
Sharing: redirect to download after authentification if requested
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/lib/Controller/ShareController.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php
index 1f8864fc5f3..856f001bbb4 100644
--- a/apps/files_sharing/lib/Controller/ShareController.php
+++ b/apps/files_sharing/lib/Controller/ShareController.php
@@ -170,10 +170,11 @@ class ShareController extends Controller {
*
* Authenticates against password-protected shares
* @param string $token
+ * @param string $redirect
* @param string $password
* @return RedirectResponse|TemplateResponse|NotFoundResponse
*/
- public function authenticate($token, $password = '') {
+ public function authenticate($token, $redirect, $password = '') {
// Check whether share exists
try {
@@ -184,7 +185,9 @@ class ShareController extends Controller {
$authenticate = $this->linkShareAuth($share, $password);
- if($authenticate === true) {
+ if ($authenticate === true && $redirect === 'download') {
+ return new RedirectResponse($this->urlGenerator->linkToRoute('files_sharing.sharecontroller.downloadShare', array('token' => $token)));
+ } else if ($authenticate === true) {
return new RedirectResponse($this->urlGenerator->linkToRoute('files_sharing.sharecontroller.showShare', array('token' => $token)));
}
@@ -294,7 +297,7 @@ class ShareController extends Controller {
// Share is password protected - check whether the user is permitted to access the share
if ($share->getPassword() !== null && !$this->linkShareAuth($share)) {
return new RedirectResponse($this->urlGenerator->linkToRoute('files_sharing.sharecontroller.authenticate',
- array('token' => $token)));
+ array('token' => $token, 'redirect' => 'preview')));
}
if (!$this->validateShare($share)) {
@@ -480,7 +483,7 @@ class ShareController extends Controller {
// Share is password protected - check whether the user is permitted to access the share
if ($share->getPassword() !== null && !$this->linkShareAuth($share)) {
return new RedirectResponse($this->urlGenerator->linkToRoute('files_sharing.sharecontroller.authenticate',
- ['token' => $token]));
+ ['token' => $token, 'redirect' => 'download']));
}
$files_list = null;