Skip to content
Browse files

soft username check at login

  • Loading branch information...
1 parent fb5139f commit 0c2fa5e98c990df51b15d4b7449fcce23f461bcc @nka11 nka11 committed Apr 18, 2012
Showing with 13 additions and 13 deletions.
  1. +1 −1 apps/menestrel
  2. +1 −1 apps/store
  3. +1 −1 py/karacos/core/mail.py
  4. +10 −10 py/karacos/objects/Domain.py
2 apps/menestrel
@@ -1 +1 @@
-Subproject commit 5ee9e1a6c93743575940bb0d7c2161063b261b0a
+Subproject commit cc4ac728e2bda3bacdf9d5e03298dab630ba9d06
2 apps/store
@@ -1 +1 @@
-Subproject commit 737d956fa4cfe10ccbd47d1bfa360a22edcab031
+Subproject commit 0564304e9b651dd99acd45eec9b7de9e292f23cc
View
2 py/karacos/core/mail.py
@@ -27,7 +27,7 @@
def valid_email(email):
import re
- reg = re.compile('([\w\.\-]+@[\w][\w\.\-]+)')
+ reg = re.compile("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$")
return reg.match(email)
def send_mail(destmail, msg):
View
20 py/karacos/objects/Domain.py
@@ -790,16 +790,16 @@ def login(self,email=None,password=None):
if self.get_user_by_name("admin@%s" % self['name']) == None:
self._create_user("admin@%s" % self['name'], "demo", False)
user = None
- if karacos.core.mail.valid_email(email):
- try:
- user = self.authenticate(email,password)
- except karacos._db.Exception, e:
-
- return {'status':'failure', 'message' : '%s' % e.parameter,
- 'errors': None }
- else:
- return {'status':'failure', 'message':_('Adresse email invalide'),
- 'errors':{'email':_('This is not a valid mail address')}}
+ #if karacos.core.mail.valid_email(email):
+ try:
+ user = self.authenticate(email,password)
+ except karacos._db.Exception, e:
+
+ return {'status':'failure', 'message' : '%s' % e.parameter,
+ 'errors': None }
+ #else:
+ # return {'status':'failure', 'message':_('Adresse email invalide'),
+ # 'errors':{'email':_('This is not a valid mail address')}}
return {'status':'success', 'message':_("Authentification réussie"),'data':self._get_user_actions_forms(), 'success': True}
login.label = _("S'authentifier")

0 comments on commit 0c2fa5e

Please sign in to comment.
Something went wrong with that request. Please try again.