mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2026-02-08 08:06:20 +01:00
added user login and registration
This commit is contained in:
0
registration/__init__.py
Normal file
0
registration/__init__.py
Normal file
3
registration/admin.py
Normal file
3
registration/admin.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
8
registration/forms.py
Normal file
8
registration/forms.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from django import forms
|
||||
|
||||
class RegistrationForm(forms.Form):
|
||||
username = forms.CharField(max_length=16, required = True)
|
||||
password = forms.CharField(widget=forms.PasswordInput())
|
||||
email = forms.CharField(max_length=254, required = True)
|
||||
api_id = forms.CharField(max_length=254, required = True)
|
||||
api_key = forms.CharField(max_length=254, required = True)
|
||||
3
registration/models.py
Normal file
3
registration/models.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
3
registration/tests.py
Normal file
3
registration/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
26
registration/views.py
Normal file
26
registration/views.py
Normal file
@@ -0,0 +1,26 @@
|
||||
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 forms import RegistrationForm
|
||||
|
||||
# Create your views here.
|
||||
def register(request):
|
||||
if request.method == 'POST':
|
||||
form = RegistrationForm(request.POST)
|
||||
|
||||
if form.is_valid():
|
||||
userManager = AllianceUserManager()
|
||||
userManager.create_user_withapi(
|
||||
form.cleaned_data['username'],
|
||||
form.cleaned_data['email'],
|
||||
form.cleaned_data['password'],
|
||||
form.cleaned_data['api_id'],
|
||||
form.cleaned_data['api_key']
|
||||
)
|
||||
|
||||
return HttpResponseRedirect("/")
|
||||
else:
|
||||
form = RegistrationForm()
|
||||
|
||||
return render_to_response('public/register.html',{'form':form}, context_instance=RequestContext(request))
|
||||
Reference in New Issue
Block a user