Commit c39ebcb7 authored by asu1996's avatar asu1996
Browse files

added username limitations

parent 8e710e05
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
NhAAAAAwEAAQAAAYEAswyXCC2nkQCjeB212/uWqmHcBCzGHLJjkTVVt+7aVNk8r91rvmI6
9OzvIdSvn4IG4NZ9usOX2btmNAN4mdWMac6GtBQh9n2szpoV/Ei/HFTbc5YLcWoxDisApn
0aUI1p7vuX2bcyu9TWl+5b0CQq9XzuaE8tCES8OBimzxH9zmRVpMQbTleek5Aql5Wkylif
WMR/DCRL4F9P7n6DqiR87Xxtgr4lBa8KL5/ZAfCRn5afHZENAMh2OolJQmNvhxdbrH1CSk
aV3yrb2GvVBQcKisuNFlucrXNjLz9L8CLevJ62GWYXTpZ6kJcXtUZBZIbA4NAeYeOkAGZ7
G2hmZZT8hoC43+dLOP+GcduC5yoNT3+o+R1p86vpr0FB+DUuUVyB5R28wCoY7gRo2qZVN6
19bspniyShG/saAxWGtfy/SD7qJSXAfzunrNqwB+tBCsXVkCHBAZpHdGAszc8u3gds2uP1
2baIYOdTyy9AbFNjqYXht1Na/HxC3xe8LcihyLiVAAAFiO9EdSvvRHUrAAAAB3NzaC1yc2
EAAAGBALMMlwgtp5EAo3gdtdv7lqph3AQsxhyyY5E1Vbfu2lTZPK/da75iOvTs7yHUr5+C
BuDWfbrDl9m7ZjQDeJnVjGnOhrQUIfZ9rM6aFfxIvxxU23OWC3FqMQ4rAKZ9GlCNae77l9
m3MrvU1pfuW9AkKvV87mhPLQhEvDgYps8R/c5kVaTEG05XnpOQKpeVpMpYn1jEfwwkS+Bf
T+5+g6okfO18bYK+JQWvCi+f2QHwkZ+Wnx2RDQDIdjqJSUJjb4cXW6x9QkpGld8q29hr1Q
UHCorLjRZbnK1zYy8/S/Ai3ryethlmF06WepCXF7VGQWSGwODQHmHjpABmextoZmWU/IaA
uN/nSz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imCLDYrdgLxn/MsXwEbTJXjcmCu0qjXu+4ES/pQongHfGgvZzm66u
fHdS+k42f627h+ax93pZk1tj8xdJOP1eCXSoXJJMWIrIMcbZYsBT2fAVH3ZAClF5iY2Tl/
cYFKlF8b+Gad653+GkXDtZG2rDWuq/AAAAwQDJPJcRrkOCf17ObAYKi3/SWtUrIzL+T40E
P+hApsvdZvsZIsEJA1HIQrnUnnui5g2qRYqpk1Z19zp3lpU+kcNywJQz1domsDU0ml25SY
BsvwarA/f0/G2PobvSWM1gSqLmvj4Webp/MWWtf/rl1szbN3SRapEjkSlUhaCpqKm6JfoC
CzDRzhmITY9mIpHzGaGI7HwLWwo4jO0awjLDdpdRHbdwnm+CToydQWyFjnbndBRIXiIhC5
XsrhPHy2GD1asAAAASYXN1dG9zaEBCbGFja0RlbW9uAQ==
-----END OPENSSH PRIVATE KEY-----
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCzDJcILaeRAKN4HbXb+5aqYdwELMYcsmORNVW37tpU2Tyv3Wu+Yjr07O8h1K+fggbg1n26w5fZu2Y0A3iZ1Yxpzoa0FCH2fazOmhX8SL8cVNtzlgtxajEOKwCmfRpQjWnu+5fZtzK71NaX7lvQJCr1fO5oTy0IRLw4GKbPEf3OZFWkxBtOV56TkCqXlaTKWJ9YxH8MJEvgX0/ufoOqJHztfG2CviUFrwovn9kB8JGflp8dkQ0AyHY6iUlCY2+HF1usfUJKRpXfKtvYa9UFBwqKy40WW5ytc2MvP0vwIt68nrYZZhdOlnqQlxe1RkFkhsDg0B5h46QAZnsbaGZllPyGgLjf50s4/4Zx24LnKg1Pf6j5HWnzq+mvQUH4NS5RXIHlHbzAKhjuBGjaplU3rX1uymeLJKEb+xoDFYa1/L9IPuolJcB/O6es2rAH60EKxdWQIcEBmkd0YCzNzy7eB2za4/XZtohg51PLL0BsU2OpheG3U1r8fELfF7wtyKHIuJU= asutosh@BlackDemon
from django.db import models
from django import forms
from django.utils.translation import gettext_lazy as _
def is_valid_username(name):
if not all(x.isalpha() or x=='_' or x.isnumeric() for x in name):
raise forms.ValidationError(
_('%(name)s is not a valid username. Should be A-Z, a-z, 0-9 and _.'),
params={'name': name},
)
def is_username_exists(name):
if GitlabAccountRequest.objects.filter(username=name).count() > 0:
raise forms.ValidationError(
_('%(name)s already exists.'),
params={'name': name},
)
class GitlabAccountRequest(models.Model):
username = models.CharField(max_length=64)
username = models.CharField(max_length=64, validators=[is_valid_username,is_username_exists])
email = models.EmailField()
reason = models.CharField(max_length=256)
approved = models.BooleanField(default=False)
......
......@@ -12,6 +12,10 @@
<label for="input-username" class="sr-only">Username</label>
<input type="text" id="input-username" name="username" class="form-control" placeholder="Username" required>
<div style="color: red; margin-bottom:10px">
{{ form.username.errors | striptags }}
</div>
<p>Please explain why you want to collaborate with the Tor community</p>
<textarea class="form-control" name="reason" maxlength="256" placeholder="For Example: I wish to report an issue in Tor Browser." rows="3"></textarea>
......
......@@ -23,6 +23,8 @@ def index(request):
approve_user(model)
return HttpResponseRedirect('/success/')
else:
return render(request, 'core/signup.html', {'form': form})
return HttpResponseRedirect('/failure/')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment