mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -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
0f762a0929
commit
19c7ac9194
1 changed files with 10 additions and 2 deletions
|
|
@ -52,6 +52,7 @@
|
|||
|
||||
<script type="ts">
|
||||
import { browserSupportsWebAuthn } from '@simplewebauthn/browser'
|
||||
import { getBaseUrl } from '@nextcloud/router'
|
||||
import { defineComponent } from 'vue'
|
||||
import NcEmptyContent from '@nextcloud/vue/components/NcEmptyContent'
|
||||
import NcTextField from '@nextcloud/vue/components/NcTextField'
|
||||
|
|
@ -147,8 +148,15 @@ export default defineComponent({
|
|||
|
||||
return finishAuthentication(challenge)
|
||||
.then(({ defaultRedirectUrl }) => {
|
||||
logger.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) => {
|
||||
logger.debug('GOT AN ERROR WHILE SUBMITTING CHALLENGE!', { error }) // Example: timeout, interaction refused...
|
||||
|
|
|
|||
Loading…
Reference in a new issue