Compare commits
2 Commits
master
...
tos-remind
Author | SHA1 | Date |
---|---|---|
Aravinth Manivannan | e8956ad068 | |
Aravinth Manivannan | 3ecd2289dc |
|
@ -13,6 +13,11 @@
|
|||
<a class="license__link" rel="noreferrer" href="https://hostea.org/about" target="_blank"
|
||||
> About</a
|
||||
>
|
||||
<span class="footer__column-divider--mobile-visible">|</span>
|
||||
<a class="license__link" rel="noreferrer" href="https://hostea.org/tos" target="_blank"
|
||||
> Terms of Service</a
|
||||
>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
<div class="footer__column">
|
||||
|
|
|
@ -549,6 +549,21 @@ footer {
|
|||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.dash__form-label--inline {
|
||||
display: flex;
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
|
||||
.dash__form-label--inline > span {
|
||||
flex: 3;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
|
||||
.dash__form-label--inline > input {
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
border: none;
|
||||
}
|
||||
|
|
|
@ -50,6 +50,21 @@
|
|||
{% endfor %}
|
||||
</div>
|
||||
</fieldset>
|
||||
<label class="dash__form-label--inline" for="tos">
|
||||
<span>
|
||||
I agree to the
|
||||
<a href="https://hostea.org/tos/">terms and conditions</a> associated with using Hostea
|
||||
</span>
|
||||
<input
|
||||
class="form__input"
|
||||
name="tos"
|
||||
required
|
||||
id="tos"
|
||||
type="checkbox"
|
||||
value="agreed"
|
||||
/>
|
||||
|
||||
</label>
|
||||
<div class="form__action-container">
|
||||
<button class="form__submit" type="submit">Create Instance</button>
|
||||
</div>
|
||||
|
|
|
@ -77,7 +77,7 @@ def infra_custom_config(test_name: str):
|
|||
def create_instance_util(
|
||||
t: TestCase, c: Client, instance_name: str, config: InstanceConfiguration
|
||||
):
|
||||
payload = {"name": instance_name, "configuration": config.name}
|
||||
payload = {"name": instance_name, "configuration": config.name, "tos": "agreed"}
|
||||
|
||||
resp = c.post(reverse("dash.instances.new"), payload)
|
||||
t.assertEqual(resp.status_code, 302)
|
||||
|
@ -298,3 +298,36 @@ class CreateInstance(TestCase):
|
|||
).exists(),
|
||||
False,
|
||||
)
|
||||
|
||||
def test_tos_agreement_check(self):
|
||||
c = Client()
|
||||
login_util(self, c, "accounts.home")
|
||||
urls = [(reverse("dash.instances.new"), "Instance Configuration")]
|
||||
for (url, test) in urls:
|
||||
print(f"[*] Testing URI: {url}")
|
||||
resp = c.get(url)
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
self.assertEqual(b"Billing" in resp.content, True)
|
||||
self.assertEqual(b"Support" in resp.content, True)
|
||||
self.assertEqual(b"Logout" in resp.content, True)
|
||||
self.assertEqual(str.encode(test) in resp.content, True)
|
||||
|
||||
# create instance
|
||||
payload = {
|
||||
"name": "test_tos_agreement_check",
|
||||
"configuration": self.instance_config[0].name,
|
||||
}
|
||||
|
||||
self.assertEqual(Instance.objects.filter(name=payload["name"]).exists(), False)
|
||||
resp = c.post(reverse("dash.instances.new"), payload)
|
||||
self.assertEqual(resp.status_code, 400)
|
||||
|
||||
self.assertEqual(
|
||||
b"created without agreeing to the terms and conditions" in resp.content,
|
||||
True,
|
||||
)
|
||||
|
||||
instance_name = "test_create_instance_renders"
|
||||
create_instance_util(
|
||||
t=self, c=c, instance_name=instance_name, config=self.instance_config[0]
|
||||
)
|
||||
|
|
|
@ -80,6 +80,21 @@ def create_instance(request):
|
|||
ctx = get_ctx()
|
||||
return render(request, "dash/instances/new/index.html", context=ctx)
|
||||
|
||||
if "tos" not in request.POST:
|
||||
ctx = get_ctx()
|
||||
ctx["error"] = {
|
||||
"title": "Can't create instance",
|
||||
"reason": "Hostea instance can't be created without agreeing to the terms and conditions",
|
||||
}
|
||||
return render(request, "dash/instances/new/index.html", status=400, context=ctx)
|
||||
if str.strip(request.POST["tos"]) != "agreed":
|
||||
ctx = get_ctx()
|
||||
ctx["error"] = {
|
||||
"title": "Can't create instance",
|
||||
"reason": "Hostea instance can't be created without agreeing to the terms and conditions",
|
||||
}
|
||||
return render(request, "dash/instances/new/index.html", status=400, context=ctx)
|
||||
|
||||
name = request.POST["name"]
|
||||
configuration = request.POST["configuration"]
|
||||
try:
|
||||
|
|
|
@ -101,3 +101,24 @@ And provide information requested
|
|||
```bash
|
||||
make
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Permission denied (publickey) in `make env`
|
||||
|
||||
`make env` runs `./integration/ci.sh init` which bootstraps a local
|
||||
Gitea instance with some repositories for running tests. It also adds a
|
||||
deploy SSH key, with read/write access to those repositories.
|
||||
|
||||
Please ensure the following:
|
||||
|
||||
1. The private key at [tests/fleet-deploy-key](../tests/fleet-deploy-key)
|
||||
has `600` permissions. If not:
|
||||
|
||||
```bash
|
||||
chmod 600 tests/fleet-deploy-key
|
||||
```
|
||||
|
||||
2. The Gitea instance listens at port 22, ensure it is listening on that
|
||||
port. This can be verified by checking for orphan Gitea instances
|
||||
and/or SSH daemons on that port.(TODO: listen SSH on different port)
|
||||
|
|
Loading…
Reference in New Issue