Пример #1
0
    def post(self):
        username = self.request.get("username")
        password = self.request.get("password")
        verify = self.request.get("verify")
        email = self.request.get("email")

        user = Validate(username, password, verify, email)

        username_error = ""
        password_error = ""
        verify_error = ""

        if user.validate():
            self.redirect("/welcome?username={0}".format(username))
        else:
            if not user.username_val():
                username_error = "That isn't a valid username."
            if not verify:
                verify_error = "Please verify your password."
            if password and verify:
                if not user.equal():
                    verify_error = "Passwords do not match."
                if not user.password_val():
                    password_error = "That isn't a valid password."

        self.write_form(username, username_error, password_error, verify_error,
                        email)
	def signUp(self):
		validtobj=Validate()
		validtobj.setname(input("enter the username: "******"enter the mail: ")) 
		validtobj.setmobile_no(input('enter the mobile no: '))
		validtobj.setplace(input('enter the native place: ')) 
		pass1=input("enter the password: "******"Re enter the password: "******"select userid from users order by userid"
		try:
			self.cursor.execute(sql)
			records=self.cursor.fetchall()
			if len(records)==0:
				validtobj.id=1001
			else:
				validtobj.id=records[-1][0]
				validtobj.id+=1
		except:
			self.db.rollback()
			print(" unable to READ from users table")
		print(validtobj.id,validtobj.username,validtobj.password,validtobj.mail,int(validtobj.mobile_no),validtobj.place)
		sql1 = "insert into users values('%d','%s','%s','%s','%d','%s')"%(validtobj.id,validtobj.username,validtobj.password,validtobj.mail,int(validtobj.mobile_no),validtobj.place)
		try:
			self.cursor.execute(sql1)
			self.db.commit()
			print("successfully inserted")
		except:
			self.db.rollback()
			print(" unable to insert new user")
			states="succ"
		self.mainMenu()
 def init_class(self):
     """ This function receives the input data from users. """
     while len(self.input) < 5:
         self.input.append(Validate().validate_values(' Digite um número: ',
                                                      zero=True))
 def init_class(self):
     """ This function receives the input data from users. """
     while len(self.list) < 2:
         self.list.append(Validate().validate_strings(self.title, 2))
Пример #5
0
 def init_class(self):
     """ This function receives the input data from users. """
     self.length = Validate().validate_values(self.title1, zero=False)
     while len(self.list) < self.length:
         self.list.append(Validate().validate_numbers(self.title2))
Пример #6
0
 def init_class(self):
     """ This function receives the input data from users. """
     while len(self.list) <= 5:
         _input = Validate().validate_values(self.title, zero=True)
         self.list.append(_input)
 def init_class(self):
     """ This function receives the input data from users. """
     self.input = Validate().validate_values(' Digite um número: ')
Пример #8
0
 def init_class(self):
     """ This function receives the input data from users. """
     for k in self.components.keys():
         self.components[k] = Validate().validate_values(k)