Add form_valid to the index form
This commit is contained in:
parent
76c585cdf4
commit
5c96f5c186
1 changed files with 10 additions and 0 deletions
10
dal/views.py
10
dal/views.py
|
@ -100,6 +100,16 @@ class LDAP(object):
|
||||||
class Index(FormView):
|
class Index(FormView):
|
||||||
template_name = "landing.html"
|
template_name = "landing.html"
|
||||||
form_class = LoginForm
|
form_class = LoginForm
|
||||||
|
success_url = 'useroptions.html'
|
||||||
|
|
||||||
|
def form_valid(self, form):
|
||||||
|
email = form.cleaned_data.get('email')
|
||||||
|
password = form.cleaned_data.get('password')
|
||||||
|
user = authenticate(username=email, password=password)
|
||||||
|
if user is not None:
|
||||||
|
login(self.request, user)
|
||||||
|
return render(self.request, 'useroptions.html', { 'user': user } )
|
||||||
|
return render(self.request, 'loginfailed.html')
|
||||||
|
|
||||||
class Register(View):
|
class Register(View):
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
|
|
Loading…
Reference in a new issue