From b0e0561345d719b2c879ce1b114a2d6db0b52b85 Mon Sep 17 00:00:00 2001
From: Kjetil Kjernsmo
Date: Mon, 15 Oct 2018 14:43:16 +0200
Subject: [PATCH 1/7] Reintroduce instructions
---
default-views/account/register-form.hbs | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/default-views/account/register-form.hbs b/default-views/account/register-form.hbs
index dbbfd117b..cd37df632 100644
--- a/default-views/account/register-form.hbs
+++ b/default-views/account/register-form.hbs
@@ -9,7 +9,25 @@
Username*
-
+
+ {{#if multiuser}}
+ Your username should be a lower-case word with only
+ letters a-z and numbers 0-9 and without periods.
+ Your public Solid POD URL will be: https://[username].hostname.com
+ Your public Solid WebID will be:
+ https://[username].hostname.com/profile/card#me
+
+ Your POD URL is like the homepage for your Solid
+ pod. By default, it is readable by the public, but you can
+ always change that if you like by changing the access
+ control.
+
+ Your Solid WebID is your globally unique name
+ that you can use to identify and authenticate yourself with
+ other PODs across the world.
+ {{/if}}
+
+
@@ -94,3 +94,14 @@
+
+
+
From e5452e1825a02a8ba0797db1d080af1fea408388 Mon Sep 17 00:00:00 2001
From: Kjetil Kjernsmo
Date: Mon, 15 Oct 2018 17:09:22 +0200
Subject: [PATCH 3/7] Communicate multiuser
---
default-views/account/register-form.hbs | 4 ++--
lib/requests/create-account-request.js | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/default-views/account/register-form.hbs b/default-views/account/register-form.hbs
index da701b3a7..d7b4e287d 100644
--- a/default-views/account/register-form.hbs
+++ b/default-views/account/register-form.hbs
@@ -10,7 +10,7 @@
-
+ {{#if multiuser}}
Your username should be a lower-case word with only
letters a-z and numbers 0-9 and without periods.
Your public Solid POD URL will be: https://alice .hostname.com
@@ -25,7 +25,7 @@
Your Solid WebID is your globally unique name
that you can use to identify and authenticate yourself with
other PODs across the world.
-
+ {{/if}}
diff --git a/lib/requests/create-account-request.js b/lib/requests/create-account-request.js
index 7c5133fc6..d18c552f2 100644
--- a/lib/requests/create-account-request.js
+++ b/lib/requests/create-account-request.js
@@ -101,7 +101,8 @@ class CreateAccountRequest extends AuthRequest {
{
returnToUrl: this.returnToUrl,
loginUrl: this.loginUrl(),
- registerDisabled: authMethod === 'tls'
+ registerDisabled: authMethod === 'tls',
+ multiuser: this.accountManager.multiuser
})
if (error) {
From ad016b44ddd1b0af0bbddf85cf35509217c33759 Mon Sep 17 00:00:00 2001
From: Kjetil Kjernsmo
Date: Mon, 15 Oct 2018 17:16:41 +0200
Subject: [PATCH 4/7] Downcase the username
---
default-views/account/register-form.hbs | 2 +-
lib/requests/create-account-request.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/default-views/account/register-form.hbs b/default-views/account/register-form.hbs
index d7b4e287d..c6624cbac 100644
--- a/default-views/account/register-form.hbs
+++ b/default-views/account/register-form.hbs
@@ -100,7 +100,7 @@
username.onkeyup = function() {
var list = document.getElementsByClassName('editable-username');
for (let item of list) {
- item.innerHTML = username.value
+ item.innerHTML = username.value.toLowerCase()
}
}
diff --git a/lib/requests/create-account-request.js b/lib/requests/create-account-request.js
index d18c552f2..284eb8655 100644
--- a/lib/requests/create-account-request.js
+++ b/lib/requests/create-account-request.js
@@ -56,7 +56,7 @@ class CreateAccountRequest extends AuthRequest {
let body = req.body || {}
- options.username = body.username
+ options.username = body.username.toLowerCase()
if (options.username) {
options.userAccount = accountManager.userAccountFrom(body)
From 78d9083dcf8f7da31734c04ddedc2f2317d285cc Mon Sep 17 00:00:00 2001
From: Kjetil Kjernsmo
Date: Tue, 16 Oct 2018 01:46:53 +0200
Subject: [PATCH 5/7] Fix bugs in downcasing
---
lib/models/account-manager.js | 2 +-
lib/requests/create-account-request.js | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/models/account-manager.js b/lib/models/account-manager.js
index 6793bdd58..8669c0435 100644
--- a/lib/models/account-manager.js
+++ b/lib/models/account-manager.js
@@ -342,7 +342,7 @@ class AccountManager {
*/
userAccountFrom (userData) {
let userConfig = {
- username: userData.username,
+ username: userData.username.toLowerCase(),
email: userData.email,
name: userData.name,
externalWebId: userData.externalWebId,
diff --git a/lib/requests/create-account-request.js b/lib/requests/create-account-request.js
index 284eb8655..16d771de1 100644
--- a/lib/requests/create-account-request.js
+++ b/lib/requests/create-account-request.js
@@ -56,7 +56,9 @@ class CreateAccountRequest extends AuthRequest {
let body = req.body || {}
- options.username = body.username.toLowerCase()
+ if (body.username) {
+ options.username = body.username.toLowerCase()
+ }
if (options.username) {
options.userAccount = accountManager.userAccountFrom(body)
@@ -201,6 +203,7 @@ class CreateAccountRequest extends AuthRequest {
*/
cancelIfUsernameInvalid (userAccount) {
if (!userAccount.username || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(userAccount.username)) {
+ debug('Invalid username ' + userAccount.username)
const error = new Error('Invalid username')
error.status = 400
throw error
From 11dada1635ef1d2d2037bb8df33a567d8857b602 Mon Sep 17 00:00:00 2001
From: Kjetil Kjernsmo
Date: Tue, 16 Oct 2018 01:56:13 +0200
Subject: [PATCH 6/7] Fix YA bug in downcasing
---
lib/models/account-manager.js | 6 +++++-
lib/requests/create-account-request.js | 3 ---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/models/account-manager.js b/lib/models/account-manager.js
index 8669c0435..05141eee7 100644
--- a/lib/models/account-manager.js
+++ b/lib/models/account-manager.js
@@ -342,7 +342,7 @@ class AccountManager {
*/
userAccountFrom (userData) {
let userConfig = {
- username: userData.username.toLowerCase(),
+ username: userData.username,
email: userData.email,
name: userData.name,
externalWebId: userData.externalWebId,
@@ -350,6 +350,10 @@ class AccountManager {
webId: userData.webid || userData.webId || userData.externalWebId
}
+ if (userConfig.username) {
+ userConfig.username = userConfig.username.toLowerCase()
+ }
+
try {
userConfig.webId = userConfig.webId || this.accountWebIdFor(userConfig.username)
} catch (err) {
diff --git a/lib/requests/create-account-request.js b/lib/requests/create-account-request.js
index 16d771de1..68997822c 100644
--- a/lib/requests/create-account-request.js
+++ b/lib/requests/create-account-request.js
@@ -58,9 +58,6 @@ class CreateAccountRequest extends AuthRequest {
if (body.username) {
options.username = body.username.toLowerCase()
- }
-
- if (options.username) {
options.userAccount = accountManager.userAccountFrom(body)
}
From 36a09fdd9525163e5c097fbc3067aa5223f536ec Mon Sep 17 00:00:00 2001
From: Kjetil Kjernsmo
Date: Tue, 16 Oct 2018 02:03:32 +0200
Subject: [PATCH 7/7] Write the hostname into the page too
---
default-views/account/register-form.hbs | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/default-views/account/register-form.hbs b/default-views/account/register-form.hbs
index c6624cbac..12166f888 100644
--- a/default-views/account/register-form.hbs
+++ b/default-views/account/register-form.hbs
@@ -13,9 +13,14 @@
{{#if multiuser}}
Your username should be a lower-case word with only
letters a-z and numbers 0-9 and without periods.
- Your public Solid POD URL will be: https://alice .hostname.com
+ Your public Solid POD URL will be:
+ https://alice .
Your public Solid WebID will be:
- https://alice .hostname.com/profile/card#me
+ https://alice ./profile/card#me
Your POD URL is like the homepage for your Solid
pod. By default, it is readable by the public, but you can