mirror of
https://github.com/nextcloud/server.git
synced 2026-06-13 10:40:40 -04:00
fix: Always redirect to an absolute URL
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
2f2cb04569
commit
4a0d4369cd
1 changed files with 10 additions and 3 deletions
|
|
@ -42,6 +42,7 @@
|
|||
|
||||
<script>
|
||||
import { browserSupportsWebAuthn } from '@simplewebauthn/browser'
|
||||
import { getBaseUrl } from '@nextcloud/router'
|
||||
import {
|
||||
startAuthentication,
|
||||
finishAuthentication,
|
||||
|
|
@ -125,9 +126,15 @@ export default {
|
|||
|
||||
return finishAuthentication(challenge)
|
||||
.then(({ defaultRedirectUrl }) => {
|
||||
console.debug('Logged in redirecting')
|
||||
// Redirect url might be false so || should be used instead of ??.
|
||||
window.location.href = redirectUrl || defaultRedirectUrl
|
||||
logger.debug('Logged in redirecting')
|
||||
if (redirectUrl) {
|
||||
if (redirectUrl.charAt(0) !== "/") {
|
||||
redirectUrl = "/" + redirectUrl;
|
||||
}
|
||||
window.location.href = getBaseUrl() + redirectUrl
|
||||
} else {
|
||||
window.location.href = defaultRedirectUrl
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.debug('GOT AN ERROR WHILE SUBMITTING CHALLENGE!')
|
||||
|
|
|
|||
Loading…
Reference in a new issue