Skip to content

Commit cb6be9a

Browse files
authored
Merge pull request #60014 from nextcloud/backport/60011/stable29
[stable29] fix: Harmonize login and passwordless login redirect behavior
2 parents 1a67ceb + 6262357 commit cb6be9a

3 files changed

Lines changed: 14 additions & 7 deletions

File tree

core/src/components/login/PasswordLessLoginForm.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
</template>
3838

3939
<script>
40+
import { getBaseUrl } from '@nextcloud/router'
4041
import {
4142
startAuthentication,
4243
finishAuthentication,
@@ -203,13 +204,19 @@ export default {
203204
completeAuthentication(challenge) {
204205
console.debug('TIME TO COMPLETE')
205206
206-
const redirectUrl = this.redirectUrl
207+
let redirectUrl = this.redirectUrl
207208
208209
return finishAuthentication(JSON.stringify(challenge))
209210
.then(({ defaultRedirectUrl }) => {
210-
console.debug('Logged in redirecting')
211-
// Redirect url might be false so || should be used instead of ??.
212-
window.location.href = redirectUrl || defaultRedirectUrl
211+
logger.debug('Logged in redirecting')
212+
if (redirectUrl) {
213+
if (redirectUrl.charAt(0) !== '/') {
214+
redirectUrl = '/' + redirectUrl
215+
}
216+
window.location.href = getBaseUrl() + redirectUrl
217+
} else {
218+
window.location.href = defaultRedirectUrl
219+
}
213220
})
214221
.catch(error => {
215222
console.debug('GOT AN ERROR WHILE SUBMITTING CHALLENGE!')

dist/core-login.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-login.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)