Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions default-templates/new-account/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ <h3>Solid User Profile</h3>
<div class="row">
<div class="col-md-12">
<p style="margin-top: 3em; margin-bottom: 3em;">
Welcome to your Solid user profile.
</p>
<p>
Your Web ID is:<br />

<code>{{webId}}</code>
Welcome to the account of <code>{{webId}}</code>
</p>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions default-templates/new-account/profile/card
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

<>
a foaf:PersonalProfileDocument ;
foaf:maker <#me> ;
foaf:primaryTopic <#me> .
foaf:maker <{{webId}}> ;
foaf:primaryTopic <{{webId}}> .

<#me>
<{{webId}}>
a foaf:Person ;
a schema:Person ;

Expand Down
24 changes: 19 additions & 5 deletions default-views/account/register-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,42 @@
</div>
{{/if}}
<div class="row">
<div class="col-md-12">
<div class="col-md-6">
<label for="username">Username:</label>
<input type="text" class="form-control" name="username" id="username" placeholder="alice" />
</div>
<div class="col-md-6">&nbsp;</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-6">
<label for="password">Password:</label>
<input type="password" class="form-control" name="password" id="password" />
</div>
<div class="col-md-6">&nbsp;</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-6">
<label for="name">Name:</label>
<input type="name" class="form-control" name="name" id="name" />
<input type="text" class="form-control" name="name" id="name" />
</div>
<div class="col-md-6">&nbsp;</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-6">
<label for="email">Email:</label>
<p>Your email will only used for account recovery</p>
<input type="email" class="form-control" name="email" id="email" />
</div>
<div class="col-md-6">&nbsp;</div>
</div>
<div class="row">
<div class="col-md-6">
<label for="externalWebId">(Optional) External WebID:</label>
<p>We will generate a Web ID when you register, but if you
already have a Web ID hosted elsewhere, enter it here</p>
<input type="text" class="form-control" name="externalWebId" id="externalWebId" />
</div>
<div class="col-md-6">&nbsp;</div>
</div>
<input type="hidden" name="returnToUrl" value="{{returnToUrl}}" />
</div>
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/error-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const SELECT_PROVIDER_AUTH_METHODS = ['oidc']
* @param next {Function}
*/
function handler (err, req, res, next) {
debug('Error page because of ' + err)
debug('Error page because of:', err)

let locals = req.app.locals
let authMethod = locals.authMethod
Expand Down
26 changes: 21 additions & 5 deletions lib/models/account-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,16 +346,32 @@ class AccountManager {
email: userData.email,
name: userData.name,
externalWebId: userData.externalWebId,
webId: userData.webid || userData.webId ||
this.accountWebIdFor(userData.username)
localAccountId: userData.localAccountId,
webId: userData.webid || userData.webId || userData.externalWebId
}

if (!userConfig.username) {
if (!userConfig.webId) {
try {
userConfig.webId = userConfig.webId || this.accountWebIdFor(userConfig.username)
} catch (err) {
if (err.message === 'Cannot construct uri for blank account name') {
throw new Error('Username or web id is required')
} else {
throw err
}
}

userConfig.username = this.usernameFromWebId(userConfig.webId)
if (userConfig.username) {
if (userConfig.externalWebId && !userConfig.localAccountId) {
// External Web ID exists, derive the local account id from username
userConfig.localAccountId = this.accountWebIdFor(userConfig.username)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this means I can automatically get a username assigned?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort of. the localAccountId just maps from the local server's username-based url to the external Web ID

.split('//')[1] // drop the https://
}
} else { // no username - derive it from web id
if (userConfig.externalWebId) {
userConfig.username = userConfig.externalWebId
} else {
userConfig.username = this.usernameFromWebId(userConfig.webId)
}
}

return UserAccount.from(userConfig)
Expand Down
4 changes: 4 additions & 0 deletions lib/models/user-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ class UserAccount {
* @param [options.webId] {string}
* @param [options.name] {string}
* @param [options.email] {string}
* @param [options.externalWebId] {string}
* @param [options.localAccountId] {string}
*/
constructor (options = {}) {
this.username = options.username
this.webId = options.webId
this.name = options.name
this.email = options.email
this.externalWebId = options.externalWebId
this.localAccountId = options.localAccountId
}

/**
Expand Down
Loading