Fix magic auth for redirects with non profile paths

This commit is contained in:
Michael Vogel 2019-09-29 02:16:09 +02:00
父節點 f00afe574b
當前提交 4e9a810206
共有 2 個文件被更改,包括 4 次插入7 次删除

查看文件

@ -192,7 +192,7 @@ function redir_magic($a, $cid, $url)
$serverret = Network::curl($basepath . '/magic');
if ($serverret->isSuccess()) {
$separator = strpos($target_url, '?') ? '&' : '?';
$target_url .= $separator . 'zrl=' . urlencode($visitor);
$target_url .= $separator . 'zrl=' . urlencode($visitor) . '&addr=' . urlencode($contact_url);
Logger::info('Redirecting with magic', ['target' => $target_url, 'visitor' => $visitor, 'contact' => $contact_url]);
$a->redirect($target_url);

查看文件

@ -33,13 +33,10 @@ class Magic extends BaseModule
$test = (!empty($_REQUEST['test']) ? intval($_REQUEST['test']) : 0);
$owa = (!empty($_REQUEST['owa']) ? intval($_REQUEST['owa']) : 0);
// NOTE: I guess $dest isn't just the profile url (could be also
// other profile pages e.g. photo). We need to find a solution
// to be able to redirct to other pages than the contact profile.
$cid = Contact::getIdForURL($dest);
if (!$cid && !empty($addr)) {
if (!empty($addr)) {
$cid = Contact::getIdForURL($addr);
} else {
$cid = Contact::getIdForURL($dest);
}
if (!$cid) {