def login(self, username, password):
     # try logging as admin
     try:
         self.user = Admin.login(username, password)
     except Admin.DoesNotExist:
         # try logging as customer
         try:
             self.user = Customer.login(username, password)
         except Customer.DoesNotExist:
             raise LoginError("The user and password combination you tried is invalid.")
 def login(self, username, password):
     # try logging as admin
     try:
         self.user = Admin.login(username, password)
     except Admin.DoesNotExist:
         # try logging as customer
         try:
             self.user = Customer.login(username, password)
         except Customer.DoesNotExist:
             raise LoginError("The user and password combination you tried is invalid.")
Exemplo n.º 3
0
 def login(self):
     '''
     Request user credentials and logs them in as either an Admin or Customer
     '''
     self.user = None
     while self.user is None:
         username = input("Username: "******"Invalid Login")