Пример #1
0
def professor_seed():
    professor = Professor()
    professor.firstname = 'حسین'
    professor.lastname = 'مقدم'
    professor.father = 'فرزاد'
    professor.sex = 'male'
    professor.national_code = '1234'
    professor.birthday = '1374-09-20'
    professor.location_brith = 'طهران'
    professor.phone = '09380934231'
    professor.mobile = '026152482'
    professor.password = bcrypt.hash('1234')
    professor.address = 'قاین میدان شیرازی'
    professor.img = 'ندارد'
    professor.save()

    professor = Professor()
    professor.firstname = 'علی'
    professor.lastname = 'احمدی'
    professor.father = 'فرزاد'
    professor.sex = 'male'
    professor.national_code = '4321'
    professor.birthday = '1374-02-20'
    professor.location_brith = 'طهران'
    professor.phone = '09380125486'
    professor.mobile = '02615452482'
    professor.password = bcrypt.hash('1234')
    professor.address = 'قاین میدان شیرازی'
    professor.img = 'ندارد'
    professor.save()

    print('create all Professors successfully')
Пример #2
0
 def up(self):
     """
     Run the migrations.
     """
     self.db.table("users").insert({
         "username":
         "******",
         "password":
         bcrypt.hash("".join(
             random.choices(string.ascii_uppercase + string.digits, k=32))),
         "id":
         12345,
         "email":
         "autoposter",
         "created_at":
         datetime.utcnow(),
         "updated_at":
         datetime.utcnow(),
     })
     self.db.table("users").insert({
         "username":
         "******",
         "password":
         bcrypt.hash("".join(
             random.choices(string.ascii_uppercase + string.digits, k=32))),
         "email":
         "*****@*****.**",
         "created_at":
         datetime.utcnow(),
         "updated_at":
         datetime.utcnow(),
     })
Пример #3
0
def student_seed():
    successful = 0

    student = Student()
    student.firstname = 'حسین'
    student.lastname = 'مقدم'
    student.father = 'فرزاد'
    student.brithday = '1374-09-20'
    student.location_brith = 'طهران'
    student.phone = '0938094831'
    student.mobile = '02623588'
    student.national_code = '1234'
    student.status = 'active'
    student.entry_semester = '1396-تیر'
    student.img = 'ندارد'
    student.address = 'قاین'
    student.student_number = 3963001
    student.id = 1
    student.password = bcrypt.hash('1234')
    successful = successful + 1 if student.save() else successful

    student = Student()
    student.firstname = 'علی'
    student.lastname = 'یداللهی'
    student.father = 'عظاالدین'
    student.brithday = '1374-09-23'
    student.location_brith = 'طهران'
    student.phone = '09137304084'
    student.mobile = '02623588'
    student.national_code = '4321'
    student.status = 'active'
    student.entry_semester = '1396-تیر'
    student.img = 'ندارد'
    student.address = 'اصفهان'
    student.student_number = 3963002
    student.id = 2
    student.password = bcrypt.hash('1234')
    successful = successful + 1 if student.save() else successful

    print(str(successful) + ' Students created successfully')
Пример #4
0
 def hash_password(self, password):
     self.password = bcrypt.hash(password)
Пример #5
0
 def hash_password(self, password):
     # self.password = pwd_context.encrypt(password)
     self.password = pwd_context.bcrypt(password)
     self.password = bcrypt.hash(password)
Пример #6
0
def make_flask_login_password(plaintext):
	return bcrypt.hash(plaintext.encode("UTF-8"))
Пример #7
0
 def __init__(self, username, email, password):
     self.name = username
     self.email = email
     self.password = bcrypt.hash(password)