Authentication mechanism changed. I don't use Django's builtin

passwords encryption anymore because the default format is something
like : <algo>$<salt>$<password>
I really think this format is not compatible with external softwares
so I use simple hashes.
This commit is contained in:
tonio
2009-03-27 09:25:09 +01:00
parent 80f17440cc
commit ab5b8d96c3
5 changed files with 59 additions and 2 deletions
+1
View File
@@ -40,6 +40,7 @@ class Mailbox(models.Model):
name = models.CharField(max_length=100)
address = models.CharField(max_length=100)
full_address = models.CharField(max_length=150)
password = models.CharField(max_length=100)
quota = models.IntegerField()
uid = models.IntegerField()
gid = models.IntegerField()
+4 -1
View File
@@ -10,6 +10,7 @@ from django.contrib.auth.models import User
from mailng import admin
from mailng.admin.models import Domain, Mailbox, Alias
from forms import MailboxForm, DomainForm, AliasForm
import md5
def _ctx_ok(url):
return {"status" : "ok", "url" : url}
@@ -114,7 +115,8 @@ def newmailbox(request, dom_id=None):
if mb.create_dir(domain):
user = User()
user.username = user.email = "%s@%s" % (mb.address, domain.name)
user.set_password(request.POST["password1"])
# user.set_password(request.POST["password1"])
user.set_unusable_password()
user.is_active = request.POST.has_key("enabled") \
and True or False
fname, lname = mb.name.split()
@@ -123,6 +125,7 @@ def newmailbox(request, dom_id=None):
user.save()
mb.user = user
mb.password = md5.new(request.POST["password1"]).hexdigest()
mb.uid = mb.gid = 500
mb.domain = domain
mb.quota = request.POST["quota"]