Esempio n. 1
0
 def register(self,name,phone,email,username,password,role):
     am = AuthModel()
     result = am.createUser(name,phone,email,username,password,role)
     if result:
         print("Successfully inserted")
         message = 'Successfully created the user. You can login now'
         return message
     else:
         print("Some problem")
         message = 'There is some issue in storing the data, kindly retry'
         return message
Esempio n. 2
0
    def register(self, name, phone, email, username, password):

        if len(name) == 0:
            message = "Name cannot be empty"
            return message

        am = AuthModel()
        result = am.createUser(name, phone, email, username, password)

        if result == 1:
            message = 'User is successfully registered. You can login now'
        else:
            message = 'Some database error. Kindly retry'

        return message
    def register(self,un,na,pa,em,ph):

        # checking the filed is empty or not
        if len(un) == 0 or len(na) == 0 or len(pa) == 0 or len(em) == 0 or len(ph) == 0 :
            mes = "some thing is null"
            return mes


        am = AuthModel()
        # sending to db
        r = am.ad(un,na,pa,em,ph)
        print(r)
        mes = 'Registered'

        # pop up
        return mes
Esempio n. 4
0
    def login(self, username, password):

        if (len(username) == 0):
            print("User name cannot be empty")

        if (len(password) == 0):
            print("password cannot be empty")

        am = AuthModel()
        result = am.get_user(username, password)

        if result:
            message = 1
            return message
        else:
            message = 'Invalid User'
            return message
Esempio n. 5
0
    def login(self,username,password):

        if len(username) == 0 :
            message = "Username cannot be empty"
            return message

        if len(password) == 0:
            message = "Password cannot be empty"
            return message

        am = AuthModel()
        result = am.getUser(username,password)
        if result:
            message = f'User found {result[1]}'
        else:
            message = f'User not found'

        return message
Esempio n. 6
0
    def register(self, name, phone, email, username, password):
        if (len(name) == 0 or len(phone) == 0 or len(email) == 0
                or len(password) == 0 or len(username) == 0):
            print("No entries must be empty")

        am = AuthModel()
        check = am.get_user(username, password)

        if (check == None):
            result = am.createUser(name, phone, email, username, password)
            print(result)

            if result == 1:
                return "User successfully registered, you can login now !"

            else:
                return "User could not Register"

        else:
            return "You have already registered, please login !"
Esempio n. 7
0
    def register(self, name, phone, email, username, password):

        if len(name) == 0:
            self.status['code'] = 0
            self.status['message'] = 'Name cannot be empty'
            return self.status

        if len(phone) < 10:
            self.status['code'] = 0
            self.status[
                'message'] = 'Phone number cannot be less than 10 digits'
            return self.status

        if len(email) == 0:
            self.status['code'] = 0
            self.status['message'] = 'Email cannot be empty'
            return self.status

        if len(username) == 0:
            self.status['code'] = 0
            self.status['message'] = 'Username cannot be empty'
            return self.status

        if len(password) == 0:
            self.status['code'] = 0
            self.status['message'] = 'Password cannot be empty'
            return self.status

        am = AuthModel()
        result = am.saveUser(name, phone, email, username, password)

        if result:
            self.status['code'] = 1
            self.status[
                'message'] = 'Successfully created used. You can login now'
            return self.status
        else:
            self.status['code'] = 0
            self.status['message'] = 'Some database error kindly retry'
            return self.status
Esempio n. 8
0
    def login(self, username, password):

        if len(username) == 0:
            message = "Username cannot be empty"
            return message

        if len(password) == 0:
            message = "password cannot be empty"
            return message

        am = AuthModel()
        result = am.getUser(username, password)
        # def detection(self):
        #     dv = detect_drowsiness()
        #       dv.load()
        if result:
            message = 1
            # message = f'Hello {result[1]}'
            return message

        else:
            message = 'User not found'
            return message
    def login(self,un,pa):

        # checking field is empty or not
        if len(un) ==0:
            mes ="No user Name"
            return mes

        if len(pa) ==0:
            mes ="No password"
            return mes

        am = AuthModel()

        # sending db
        r=am.show(un,pa)

        # printing all
        print(r)

        # for home and details
        global dn
        dn = r

        # if r has value is true
        if r:

            # user found
            mes = 1
            # pop up
            return mes

        else:

            # user not found
            mes = "user not found"
            # pop up
            return mes
Esempio n. 10
0
    def login(self, username, password):

        if len(username) == 0:
            self.status['code'] = 0
            self.status['message'] = 'Username cannot be empty'
            return self.status

        if len(password) == 0:
            self.status['code'] = 0
            self.status['message'] = 'Password cannot be empty'
            return self.status

        am = AuthModel()
        result = am.checkUser(username, password)

        if result:
            self.status['role'] = result[5]
            self.status['code'] = 1
            self.status['message'] = 'Login Successful'
            return self.status
        else:
            self.status['code'] = 0
            self.status['message'] = 'Username or Password is incorrect'
            return self.status