mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2026-02-09 08:36:23 +01:00
Clean project
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
@@ -1,20 +0,0 @@
|
||||
from django import forms
|
||||
|
||||
|
||||
class RegistrationForm(forms.Form):
|
||||
username = forms.CharField(max_length=16, required=True)
|
||||
password = forms.CharField(widget=forms.PasswordInput(), required=True)
|
||||
password_again = forms.CharField(widget=forms.PasswordInput(), required=True, label="Password Again")
|
||||
email = forms.CharField(max_length=254, required=True)
|
||||
email_again = forms.CharField(max_length=254, required=True, label="Email Again")
|
||||
|
||||
def clean(self):
|
||||
if 'password' in self.cleaned_data and 'password_again' in self.cleaned_data:
|
||||
if self.cleaned_data['password'] != self.cleaned_data['password_again']:
|
||||
raise forms.ValidationError(u'Passwords do not match')
|
||||
|
||||
if 'email' in self.cleaned_data and 'email_again' in self.cleaned_data:
|
||||
if self.cleaned_data['email'] != self.cleaned_data['email_again']:
|
||||
raise forms.ValidationError(u'Emails do not match')
|
||||
|
||||
return self.cleaned_data
|
||||
@@ -1,3 +0,0 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
@@ -1,3 +0,0 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
@@ -1,36 +0,0 @@
|
||||
from django.http import Http404,HttpResponseRedirect
|
||||
from django.shortcuts import render_to_response, render
|
||||
from django.template import RequestContext
|
||||
from authentication.models import AllianceUserManager
|
||||
from evespecific.managers import EveManager
|
||||
from services.eveapi_manager import EveApiManager
|
||||
|
||||
from forms import RegistrationForm
|
||||
|
||||
|
||||
def register(request):
|
||||
api = EveApiManager()
|
||||
evemanager = EveManager()
|
||||
|
||||
if request.method == 'POST':
|
||||
form = RegistrationForm(request.POST)
|
||||
|
||||
if form.is_valid():
|
||||
usermanager = AllianceUserManager()
|
||||
if not usermanager.check_if_user_exist_by_name(form.cleaned_data['username']):
|
||||
user = usermanager.create_user(
|
||||
form.cleaned_data['username'],
|
||||
form.cleaned_data['email'],
|
||||
form.cleaned_data['password']
|
||||
)
|
||||
|
||||
return HttpResponseRedirect("/dashboard")
|
||||
|
||||
else:
|
||||
return render_to_response('public/register.html', {'form': form, 'error': True}
|
||||
, context_instance=RequestContext(request))
|
||||
|
||||
else:
|
||||
form = RegistrationForm()
|
||||
|
||||
return render_to_response('public/register.html', {'form': form}, context_instance=RequestContext(request))
|
||||
Reference in New Issue
Block a user