!! VERY UNSTABLE CHANGESET !!

Many updates in this commit:
 * first work on the webmail plugin, for now only emails listing and folders browsing is supported...
 * New login form,
 * New graphical layout (still needing improvments)
 * code factoring between webmail and quarantine plugins
 * etc.
This commit is contained in:
Antoine Nguyen
2010-01-15 12:15:15 +01:00
parent 6074497a80
commit 6c7a64e947
59 changed files with 1813 additions and 484 deletions
View File
+7
View File
@@ -0,0 +1,7 @@
from django import forms
from django.utils.translation import ugettext as _
class LoginForm(forms.Form):
username = forms.CharField(label=_("Username"))
password = forms.CharField(label=_("Password"), widget=forms.PasswordInput,
help_text=_("Password used to authenticate"))
Executable
+3
View File
@@ -0,0 +1,3 @@
from django.db import models
# Create your models here.
Executable
+23
View File
@@ -0,0 +1,23 @@
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.failUnlessEqual(1 + 1, 2)
__test__ = {"doctest": """
Another way to test that 1 + 1 is equal to 2.
>>> 1 + 1 == 2
True
"""}
Executable
+32
View File
@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
from django.contrib.auth import authenticate, login
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
import mailng.admin
from forms import LoginForm
def dologin(request):
error = None
if request.method == "POST":
form = LoginForm(request.POST)
user = authenticate(username=request.POST["username"],
password=request.POST["password"])
if user:
if user.is_active:
login(request, user)
request.session["password"] = request.POST["password"]
next = request.POST["next"]
if next == "None":
next = reverse(mailng.admin.views.domains)
return HttpResponseRedirect(next)
else:
error = _("Account is disabled.")
error = _("Your username and password didn't match. Please try again.")
else:
form = LoginForm()
next = request.GET.has_key("next") and request.GET["next"] or None
return render_to_response("registration/login.html", {
"form" : form, "error" : error, "next" : next
})