예제 #1
0
        def signUp():
            # check if fields are empty, if password match and if email is in correct format
            if hm.check_fields_inputs(
                    fNameEntry=f_name_entry,
                    middleInitialEntry=middle_initial_entry,
                    lNameEntry=l_name_entry,
                    instEntry=inst_entry,
                    passwordEntry=password_entry,
                    reEnterPasswordEntry=retype_password_entry,
                    emailEntry=email_entry,
                    checkEmailFormat=email_entry.get()):
                get_values()
                print(self.first_name)
                print(self.middle_Initial)
                print(self.last_name)
                print(self.institution)

                # Check if email is already in use by another researcher
                if conn.email_exist(email_entry.get()):
                    hm.showerror(
                        "Error",
                        "\u2022    This email is already registered.\n      Please use another email"
                    )
                else:
                    # Call the function to hash pw and save it to variable
                    hashed_pw = hash_password(self.pw)
                    # Save new researcher into Azure database
                    conn.insert(conn.researcher, self.email, hashed_pw,
                                self.first_name, self.middle_Initial,
                                self.last_name, self.institution)
                    controller.show_login_frame()
예제 #2
0
        def get_values():
            """ Validates all fields in LogPatient frame for correct input """
            if hm.check_fields_inputs(
                    ageEntry=age_entry,
                    heightEntryFt=height_entry_ft,
                    heightEntryIn=height_entry_in,
                    weightEntry=weight_entry,
                    ethnicityOption=self.ethnicity_option_selected.get(),
                    genderOption=self.gender_option_selected.get(),
                    skinColorOption=self.skin_color_type.get()):

                self.age_value = int(age_entry.get())
                self.height_value_ft = int(height_entry_ft.get())
                self.height_value_in = int(height_entry_in.get())
                self.weight_value = int(weight_entry.get())
                return True
            else:
                return False
예제 #3
0
 def check_credentials():
     """ Validates email and password when logging into the database """
     if hm.check_fields_inputs(emailEntry=email_entry,
                               passwordEntry=password_entry,
                               checkEmailFormat=email_entry.get()):
         # Get list of emails from db and check if input email is in that list
         if conn.email_exist(email_entry.get()):
             stored_pw = conn.select('passwrd', conn.researcher,
                                     'email', email_entry.get())
             # If email is in the list verify the password and allow access, else prompt error
             if verify_password(stored_pw, password_entry.get()):
                 hm.current_researcher = conn.select(
                     'researcher_id', conn.researcher, 'email',
                     email_entry.get())
                 controller.show_patientLog_frame()
             else:
                 hm.showerror("Authentication Error",
                              "\u2022    Wrong Password. Try again")
         else:
             hm.showerror("Error",
                          "\u2022    This email is not registered")