Skip to content

Commit fc875c9

Browse files
committed
Redirects to users Pod by default after creating account
This solves #1271
1 parent 5729fe5 commit fc875c9

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

common/js/auth-buttons.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
// Redirect to the registration page
4444
function register () {
4545
const registration = new URL('/register', location)
46-
registration.searchParams.set('returnToUrl', location)
4746
location.href = registration
4847
}
4948
})(solid)

lib/models/user-account.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ class UserAccount {
7676
return parsed.protocol + '//' + parsed.host
7777
}
7878

79+
/**
80+
* Returns the Uri to the account's Pod
81+
*
82+
* @return {string}
83+
*/
84+
get podUri () {
85+
const webIdUrl = url.parse(this.webId)
86+
const podUrl = `${webIdUrl.protocol}//${webIdUrl.host}`
87+
return url.format(podUrl)
88+
}
89+
7990
/**
8091
* Returns the URI of the WebID Profile for this account.
8192
* Usage:

lib/requests/create-account-request.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,15 @@ class CreateOidcAccountRequest extends CreateAccountRequest {
309309
})
310310
}
311311

312+
/**
313+
* Generate the response for the account creation
314+
*
315+
* @param userAccount {UserAccount}
316+
*
317+
* @return {UserAccount}
318+
*/
312319
sendResponse (userAccount) {
313-
let redirectUrl = this.returnToUrl || this.loginUrl()
320+
let redirectUrl = this.returnToUrl || userAccount.podUri
314321
this.response.redirect(redirectUrl)
315322

316323
return userAccount

0 commit comments

Comments
 (0)