Skip to content

Commit a08c77c

Browse files
committed
Added connectExternalWebId as opt-in via checkbox
1 parent 82f7a0d commit a08c77c

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

default-views/account/register-form.hbs

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,26 @@
6363
<span class="help-block">Your email will only be used for account recovery</span>
6464
</div>
6565

66-
<div class="form-group">
66+
<div class="checkbox">
67+
<label>
68+
<input type="checkbox" name="connectExternalWebId" value="true" id="ConnectExternalWebId" {{#if connectExternalWebId}}checked{{/if}}/>
69+
Connect to External WebID (<strong>Advanced feature</strong> {{ connectExternalWebId ? "true" : "false" }})
70+
</label>
71+
</div>
72+
73+
<div class="form-group hidden" id="ExternalWebId">
6774
<label class="control-label" for="externalWebId">External WebID:</label>
6875
<input type="text" class="form-control" name="externalWebId" id="externalWebId" value="{{externalWebId}}"/>
6976
<span class="help-block">
70-
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
77+
By connecting this account with an existing webId, you can use that webId to authenticate with the new account.
7178
</span>
7279
</div>
7380

7481
{{#if enforceToc}}
7582
{{#if tocUri}}
7683
<div class="checkbox">
7784
<label>
78-
<input type="checkbox" name="acceptToc" value="true" {{acceptToc ? "checked" : ""}}>
85+
<input type="checkbox" name="acceptToc" value="true" {{#if acceptToc}}checked{{/if}}>
7986
I agree to the <a href="{{tocUri}}" target="_blank">Terms &amp; Conditions</a> of this service
8087
</label>
8188
</div>
@@ -114,10 +121,19 @@
114121
<script>
115122
var username = document.getElementById('username');
116123
username.onkeyup = function() {
117-
var list = document.getElementsByClassName('editable-username');
118-
for (let item of list) {
119-
item.innerHTML = username.value.toLowerCase()
124+
var list = document.getElementsByClassName('editable-username');
125+
for (let item of list) {
126+
item.innerHTML = username.value.toLowerCase()
127+
}
120128
}
121-
}
129+
130+
window.addEventListener('DOMContentLoaded', function () {
131+
var connect = document.getElementById('ConnectExternalWebId')
132+
var container = document.getElementById('ExternalWebId')
133+
container.classList.toggle('hidden', !connect.checked)
134+
connect.addEventListener('change', function () {
135+
container.classList.toggle('hidden', !connect.checked)
136+
})
137+
})
122138
</script>
123139

lib/requests/create-account-request.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ class CreateAccountRequest extends AuthRequest {
121121
name: data.name,
122122
email: data.email,
123123
externalWebId: data.externalWebId,
124-
acceptToc: data.acceptToc
124+
acceptToc: data.acceptToc,
125+
connectExternalWebId: data.connectExternalWebId
125126
})
126127

127128
if (error) {

0 commit comments

Comments
 (0)