Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e364266
Directly serve mashlib's data browser bundle
Vinnl Jun 6, 2019
79c686c
Preserving values if user encounter an error in account creation
megoth Jul 22, 2019
fc875c9
Redirects to users Pod by default after creating account
megoth Jul 22, 2019
82f7a0d
Merge branch 'account-creation-redirect'
Jul 23, 2019
a08c77c
Added connectExternalWebId as opt-in via checkbox
megoth Jul 23, 2019
7abed3b
Fixed a minor bug
megoth Jul 23, 2019
982d904
Even more minor fix...
megoth Jul 23, 2019
a9c14b8
A quick and dirty solution for redirecting after logging in
megoth Jul 23, 2019
65a93df
Clear the value for externalWebId if checkbox is not checked
megoth Jul 23, 2019
1f14e9f
Removing the default index.html for new accounts
megoth Jul 23, 2019
371894e
Merge remote-tracking branch 'origin/externalWebID-as-opt-in' into dev
michielbdejong Jul 23, 2019
a6703ed
Merge remote-tracking branch 'origin/login-redirect' into dev
michielbdejong Jul 23, 2019
8f95bef
update dependencies
michielbdejong Jul 23, 2019
8fcdce0
Merge branch 'mashlib-bundle' into dev
megoth Jul 24, 2019
1e5872d
Upgraded deps
megoth Jul 24, 2019
6f24e41
Upgrading deps
megoth Aug 6, 2019
458344b
Upgraded deps
megoth Aug 6, 2019
0a59a2d
Suggesting specific version to use when building package-lock
megoth Aug 8, 2019
aac572d
Upgraded to latest prerelease of mashlib
megoth Aug 8, 2019
32923d9
Upgraded to latest prerelease of mashlib
megoth Aug 8, 2019
92e11eb
Upgraded to latest prerelease of mashlib
megoth Aug 8, 2019
009f655
Upgraded to latest version of mashlib
megoth Aug 12, 2019
d828545
Bump version
Aug 13, 2019
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
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v8.16.0
5 changes: 3 additions & 2 deletions common/js/auth-buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
await auth.logout()
}
// Now that we have a cookie, reload to display the authenticated page
location.reload()
const webId = new URL(session.webId)
const podUrl = `${webId.protocol}//${webId.host}`
location.href = podUrl
}
}

Expand All @@ -43,7 +45,6 @@
// Redirect to the registration page
function register () {
const registration = new URL('/register', location)
registration.searchParams.set('returnToUrl', location)
location.href = registration
}
})(solid)
77 changes: 0 additions & 77 deletions default-templates/new-account/index.html

This file was deleted.

48 changes: 36 additions & 12 deletions default-views/account/register-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-body">
<form method="post" action="/api/accounts/new">
<form method="post" action="/api/accounts/new" id="RegisterForm">
{{> shared/error}}

<div class="form-group">
<label class="control-label" for="username">Username*</label>
<input type="text" class="form-control" name="username" id="username" placeholder="alice"
required/>
required value="{{username}}"/>

{{#if multiuser}}
<p>Your username should be a lower-case word with only
Expand Down Expand Up @@ -54,28 +54,35 @@

<div class="form-group">
<label class="control-label" for="name">Name*</label>
<input type="text" class="form-control" name="name" id="name" required/>
<input type="text" class="form-control" name="name" id="name" required value="{{name}}"/>
</div>

<div class="form-group">
<label class="control-label" for="email">Email*</label>
<input type="email" class="form-control" name="email" id="email"/>
<input type="email" class="form-control" name="email" id="email" value="{{email}}"/>
<span class="help-block">Your email will only be used for account recovery</span>
</div>

<div class="form-group">
<div class="checkbox">
<label>
<input type="checkbox" name="connectExternalWebId" value="true" id="ConnectExternalWebId" {{#if connectExternalWebId}}checked{{/if}}/>
Connect to External WebID (<strong>Advanced feature</strong>)
</label>
</div>

<div class="form-group hidden" id="ExternalWebId">
<label class="control-label" for="externalWebId">External WebID:</label>
<input type="text" class="form-control" name="externalWebId" id="externalWebId"/>
<input type="text" class="form-control" name="externalWebId" id="externalWebId" value="{{externalWebId}}"/>
<span class="help-block">
We will generate a Web ID when you register, but if you already have a Web ID hosted elsewhere that you'd prefer to use to log in, enter it here
By connecting this account with an existing webId, you can use that webId to authenticate with the new account.
Copy link
Member

@TallTed TallTed Jul 24, 2019

Choose a reason for hiding this comment

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

human-facing webId or Web ID should change to always be one word, capitalized as WebID

</span>
</div>

{{#if enforceToc}}
{{#if tocUri}}
<div class="checkbox">
<label>
<input type="checkbox" name="acceptToc" value="true">
<input type="checkbox" name="acceptToc" value="true" {{#if acceptToc}}checked{{/if}}>
I agree to the <a href="{{tocUri}}" target="_blank">Terms &amp; Conditions</a> of this service
</label>
</div>
Expand Down Expand Up @@ -114,10 +121,27 @@
<script>
var username = document.getElementById('username');
username.onkeyup = function() {
var list = document.getElementsByClassName('editable-username');
for (let item of list) {
item.innerHTML = username.value.toLowerCase()
var list = document.getElementsByClassName('editable-username');
for (let item of list) {
item.innerHTML = username.value.toLowerCase()
}
}
}
window.addEventListener('DOMContentLoaded', function () {
var connect = document.getElementById('ConnectExternalWebId')
var container = document.getElementById('ExternalWebId')
container.classList.toggle('hidden', !connect.checked)
connect.addEventListener('change', function () {
container.classList.toggle('hidden', !connect.checked)
})
var form = document.getElementById('RegisterForm')
var externalWebIdField = document.getElementById('externalWebId')
form.addEventListener('submit', function () {
if (!connect.checked) {
externalWebIdField.value = ''
}
})
})
</script>

4 changes: 1 addition & 3 deletions lib/create-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ function createApp (argv = {}) {

// Serve the public 'common' directory (for shared CSS files, etc)
app.use('/common', express.static(path.join(__dirname, '../common')))
routeResolvedFile(app, '/common/js/', 'mashlib/dist/mashlib.js')
routeResolvedFile(app, '/common/js/', 'mashlib/dist/mashlib.min.js')
routeResolvedFile(app, '/common/js/', 'mashlib/dist/mashlib.min.js.map')
app.use('/', express.static(path.join(__dirname, '../node_modules/mashlib/dist'), { index: false }))
routeResolvedFile(app, '/common/js/', 'solid-auth-client/dist-lib/solid-auth-client.bundle.js')
routeResolvedFile(app, '/common/js/', 'solid-auth-client/dist-lib/solid-auth-client.bundle.js.map')
app.use('/.well-known', express.static(path.join(__dirname, '../common/well-known')))
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async function handler (req, res, next) {

if (useDataBrowser) {
res.set('Content-Type', 'text/html')
const defaultDataBrowser = _path.join(__dirname, '../../static/databrowser.html')
const defaultDataBrowser = _path.join(__dirname, '../../node_modules/mashlib/dist/index.html')
const dataBrowserPath = ldp.dataBrowserPath === 'default' ? defaultDataBrowser : ldp.dataBrowserPath
debug(' sending data browser file: ' + dataBrowserPath)
res.sendFile(dataBrowserPath)
Expand Down
11 changes: 11 additions & 0 deletions lib/models/user-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ class UserAccount {
return parsed.protocol + '//' + parsed.host
}

/**
* Returns the Uri to the account's Pod
*
* @return {string}
*/
get podUri () {
const webIdUrl = url.parse(this.webId)
const podUrl = `${webIdUrl.protocol}//${webIdUrl.host}`
return url.format(podUrl)
}

/**
* Returns the URI of the WebID Profile for this account.
* Usage:
Expand Down
4 changes: 2 additions & 2 deletions lib/requests/auth-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ class AuthRequest {
*
* @param error {Error}
*/
error (error) {
error (error, body) {
error.statusCode = error.statusCode || 400

this.renderForm(error)
this.renderForm(error, body)
}

/**
Expand Down
21 changes: 17 additions & 4 deletions lib/requests/create-account-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class CreateAccountRequest extends AuthRequest {
request.validate()
await request.createAccount()
} catch (error) {
request.error(error)
request.error(error, req.body)
}
}

Expand All @@ -106,7 +106,7 @@ class CreateAccountRequest extends AuthRequest {
/**
* Renders the Register form
*/
renderForm (error) {
renderForm (error, data = {}) {
let authMethod = this.accountManager.authMethod

let params = Object.assign({}, this.authQueryParams, {
Expand All @@ -116,7 +116,13 @@ class CreateAccountRequest extends AuthRequest {
registerDisabled: authMethod === 'tls',
returnToUrl: this.returnToUrl,
tocUri: this.tocUri,
disablePasswordChecks: this.disablePasswordChecks
disablePasswordChecks: this.disablePasswordChecks,
username: data.username,
name: data.name,
email: data.email,
externalWebId: data.externalWebId,
acceptToc: data.acceptToc,
connectExternalWebId: data.connectExternalWebId
})

if (error) {
Expand Down Expand Up @@ -309,8 +315,15 @@ class CreateOidcAccountRequest extends CreateAccountRequest {
})
}

/**
* Generate the response for the account creation
*
* @param userAccount {UserAccount}
*
* @return {UserAccount}
*/
sendResponse (userAccount) {
let redirectUrl = this.returnToUrl || this.loginUrl()
let redirectUrl = this.returnToUrl || userAccount.podUri
this.response.redirect(redirectUrl)

return userAccount
Expand Down
Loading