|
2 | 2 | <div class="col-md-6">
|
3 | 3 | <div class="panel panel-default">
|
4 | 4 | <div class="panel-body">
|
5 |
| - <form method="post" action="/api/accounts/new"> |
| 5 | + <form method="post" action="/api/accounts/new" id="RegisterForm"> |
6 | 6 | {{> shared/error}}
|
7 | 7 |
|
8 | 8 | <div class="form-group">
|
9 | 9 | <label class="control-label" for="username">Username*</label>
|
10 | 10 | <input type="text" class="form-control" name="username" id="username" placeholder="alice"
|
11 |
| - required/> |
| 11 | + required value="{{username}}"/> |
12 | 12 |
|
13 | 13 | {{#if multiuser}}
|
14 | 14 | <p>Your username should be a lower-case word with only
|
|
54 | 54 |
|
55 | 55 | <div class="form-group">
|
56 | 56 | <label class="control-label" for="name">Name*</label>
|
57 |
| - <input type="text" class="form-control" name="name" id="name" required/> |
| 57 | + <input type="text" class="form-control" name="name" id="name" required value="{{name}}"/> |
58 | 58 | </div>
|
59 | 59 |
|
60 | 60 | <div class="form-group">
|
61 | 61 | <label class="control-label" for="email">Email*</label>
|
62 |
| - <input type="email" class="form-control" name="email" id="email"/> |
| 62 | + <input type="email" class="form-control" name="email" id="email" value="{{email}}"/> |
63 | 63 | <span class="help-block">Your email will only be used for account recovery</span>
|
64 | 64 | </div>
|
65 | 65 |
|
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>) |
| 70 | + </label> |
| 71 | + </div> |
| 72 | + |
| 73 | + <div class="form-group hidden" id="ExternalWebId"> |
67 | 74 | <label class="control-label" for="externalWebId">External WebID:</label>
|
68 |
| - <input type="text" class="form-control" name="externalWebId" id="externalWebId"/> |
| 75 | + <input type="text" class="form-control" name="externalWebId" id="externalWebId" value="{{externalWebId}}"/> |
69 | 76 | <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. |
71 | 78 | </span>
|
72 | 79 | </div>
|
73 | 80 |
|
74 | 81 | {{#if enforceToc}}
|
75 | 82 | {{#if tocUri}}
|
76 | 83 | <div class="checkbox">
|
77 | 84 | <label>
|
78 |
| - <input type="checkbox" name="acceptToc" value="true"> |
| 85 | + <input type="checkbox" name="acceptToc" value="true" {{#if acceptToc}}checked{{/if}}> |
79 | 86 | I agree to the <a href="{{tocUri}}" target="_blank">Terms & Conditions</a> of this service
|
80 | 87 | </label>
|
81 | 88 | </div>
|
|
114 | 121 | <script>
|
115 | 122 | var username = document.getElementById('username');
|
116 | 123 | 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 | + } |
120 | 128 | }
|
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 | +
|
| 138 | + var form = document.getElementById('RegisterForm') |
| 139 | + var externalWebIdField = document.getElementById('externalWebId') |
| 140 | + form.addEventListener('submit', function () { |
| 141 | + if (!connect.checked) { |
| 142 | + externalWebIdField.value = '' |
| 143 | + } |
| 144 | + }) |
| 145 | + }) |
122 | 146 | </script>
|
123 | 147 |
|
0 commit comments