Task #9611: Add support for writing DNS entries matrix.ungleich.cloud and matrix.0co2.cloud
This commit is contained in:
parent
5bb0c4cdda
commit
7986b825a7
31 changed files with 626 additions and 478 deletions
|
|
@ -5,6 +5,7 @@ from django.forms import ModelForm
|
|||
from django.utils.translation import get_language, ugettext_lazy as _
|
||||
from django.core.exceptions import ValidationError
|
||||
from .validators import domain_name_validator
|
||||
from .models import VMInstance
|
||||
from uncloud_pay.models import BillingAddress
|
||||
|
||||
|
||||
|
|
@ -37,7 +38,24 @@ class InitialRequestForm(MainForm):
|
|||
storage = forms.IntegerField(label='Storage', min_value=100, max_value=10000, initial=100)
|
||||
pricing_name = forms.CharField(required=True)
|
||||
|
||||
class RequestHostedVMForm(InitialRequestForm):
|
||||
class RequestDomainsNamesForm(MainForm):
|
||||
homeserver_name = forms.CharField(required=True, widget=forms.TextInput(attrs={'placeholder': 'Homeserver Name *'}))
|
||||
webclient_name = forms.CharField(required=True, widget=forms.TextInput(attrs={'placeholder': 'Webclient Name *'}))
|
||||
is_open_registration = forms.BooleanField(required=False, initial=False)
|
||||
|
||||
def clean_homeserver_name(self):
|
||||
homeserver_name = self.cleaned_data['homeserver_name']
|
||||
if VMInstance.objects.filter(homeserver_domain=f"{homeserver_name}.matrix.ungleich.cloud").exists():
|
||||
raise ValidationError("homeserver name already exists")
|
||||
return homeserver_name
|
||||
|
||||
def clean_webclient_name(self):
|
||||
webclient_name = self.cleaned_data['webclient_name']
|
||||
if VMInstance.objects.filter(webclient_domain=f"{webclient_name}.matrix.0co2.cloud").exists():
|
||||
raise ValidationError("webclient name already exists")
|
||||
return webclient_name
|
||||
|
||||
class RequestDomainsForm(MainForm):
|
||||
matrix_domain = DomainNameField(required=True, widget=forms.TextInput(attrs={'placeholder': 'Matrix Domain *'}))
|
||||
homeserver_domain = DomainNameField(required=True, widget=forms.TextInput(attrs={'placeholder': 'Homeserver Domain *'}))
|
||||
webclient_domain = DomainNameField(required=True, widget=forms.TextInput(attrs={'placeholder': 'Webclient Domain *'}))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue