Exemplo n.º 1
0
 def validate(self):
     if not Form.validate(self):
         return False
     name = self.user_name.data.lower()
     passwd = self.user_pass.data.lower()
     if self.user_pass.data != self.confirm_user_pass.data:
         self.confirm_user_pass.errors.append("Passwords do not match !")
         return False
     if User.exists(name, passwd):
         self.user_name.errors.append("This Username is already taken !")
         return False
     email = self.user_email.data.lower()
     if AddUser.add_user(name, passwd, email):
         if AddUser.gen_temp_url_key(name, passwd):
             print 'DEBUG: forms.validate.add_user :: gen_temp_url_key : True'
             return True
     else:
         self.user_email.errors.append("This email is already taken !")
         return False
Exemplo n.º 2
0
 def validate(self):
     if not Form.validate(self):
         return False
     user_name = self.user_name.data.lower()
     user_pass = self.user_pass.data.lower()
     if User.exists(user_name, user_pass):
         if AddUser.gen_temp_url_key(user_name, user_pass):
             print 'DEBUG: forms.validate.LoginForm :: gen_temp_url_key : True'
             return User.get_info(user_name, user_pass)
     else:
         self.submit.errors.append("Invalid user name or password !!!")
         return False