Exemple #1
0
 def check_duplicate_email(self, email):
     duplicate = False
     with CustomerDatabaseUtils() as db:
         for cust in db.getAllCustomers():
             if cust[4] == email:
                 duplicate = True
     return duplicate
Exemple #2
0
 def login(self, email, password):
     find = False
     with CustomerDatabaseUtils() as db:
         for cust in db.getAllCustomers():
             find = False
             if cust[4] == email and self.verify_password(
                     cust[5], password):
                 find = True
                 break
     return find
Exemple #3
0
 def insertCustomer(self, fname, lastname, dob, email, password, phone,
                    plan, expiry):
     with CustomerDatabaseUtils() as db:
         db.insertDummy(fname, lastname, dob, email,
                        self.hash_password(password), phone, plan, expiry)
Exemple #4
0
 def createCustomerTable(self):
     with CustomerDatabaseUtils() as db:
         db.deleteTable()
         db.createCustomerTable()
Exemple #5
0
 def getCustomer(self, email):
     with CustomerDatabaseUtils() as db:
         for cust in db.getCustomer(email):
             return cust
     return None
Exemple #6
0
 def register(self, fname, lastname, dob, email, password, phone):
     with CustomerDatabaseUtils() as db:
         db.insertCustomer(fname, lastname, dob, email,
                           self.hash_password(password), phone, 0)
Exemple #7
0
 def set_premium_expiry(self, cust_id):
     with CustomerDatabaseUtils() as db:
         today = date.today()
         from datetime import timedelta
         today = today + timedelta(days=30)
         return db.set_premium_expiry(today, cust_id)
Exemple #8
0
 def set_plan(self, plan, cust_id):
     with CustomerDatabaseUtils() as db:
         if plan == 0:
             db.set_plan_premium(cust_id)
         else:
             db.set_plan_standard(cust_id)
Exemple #9
0
 def getAllCustomers(self):
     with CustomerDatabaseUtils() as db:
         return db.getAllCustomers()
Exemple #10
0
 def resetPassword(self, password, cust_id):
     with CustomerDatabaseUtils() as db:
         db.resetPassword(self.hash_password(password), cust_id)