Ejemplo n.º 1
0
    def chng_pwd(self, win, vals):

        if not vals['txt_original'] or not vals['txt_new'] or not vals[
                'txt_confirm']:
            self.display_err("Cannot have any blanks.")
            self.clear_fields(win)
        else:
            if not self.verify_old_pwd(vals['txt_original']):
                self.display_err("The original password entered is incorrect.")
                self.clear_fields(win)
            else:
                if vals['txt_new'] != vals['txt_confirm']:
                    self.display_err(
                        "New password must match the confirm password.")
                    self.clear_fields(win)
                else:
                    MsgBox = self.msg_confirmation(
                        'Are you sure you want CHANGE your password?')
                    if MsgBox == "yes":
                        qry = "UPDATE Admin_Table SET pwd = '" + vals[
                            'txt_new'] + "' WHERE id = 1"
                        work_admin_db().execute_query_db(qry)
                        self.clear_fields(win)
                        messagebox.showinfo("Success",
                                            "Your password has been changed.")
Ejemplo n.º 2
0
 def get_db_data(self):
     admin_db_data = work_admin_db().get_all_db()
     self.saved_data['Email'] = admin_db_data[0][4]
     self.saved_data['Phone'] = admin_db_data[0][3]
     self.saved_data['Sid'] = admin_db_data[0][10]
     self.saved_data['Token'] = admin_db_data[0][12]
     self.saved_data['Tphone'] = admin_db_data[0][11]
Ejemplo n.º 3
0
 def confirm_pwd(self, win, vals):            
     admin_pwd = work_admin_db().search_pwd_db()           
     if vals["txt_pwd"] == admin_pwd[0][0]:   
         win.Hide()                    
         self.close_window()
         self.callback()       
     else:
         self.clear_fields(win)
         self.display_err("Incorrect password!")
Ejemplo n.º 4
0
 def get_db_data(self):
     admin_db_data = work_admin_db().get_all_db()
     self.mult_results['pic_enable'] = admin_db_data[0][5]
     self.mult_results['vid_enable'] = admin_db_data[0][7]
     self.mult_results['vid_frames'] = admin_db_data[0][8]
     self.mult_results['vid_length'] = admin_db_data[0][9]
     if self.mult_results['vid_enable'] == 1:
         self.mult_results['vid_enable_txt'] = "Enabled"
     else:
         self.mult_results['vid_enable_txt'] = "Disabled"
Ejemplo n.º 5
0
    def save_to_db(self, win, values):
                
        email = values['txt_email']
        phone = values['txt_phone']
        api_key = values['txt_sid']   
        twToken = values['txt_token']
        twPhone = values['txt_tphone']

        # Verifies that the fields are not blank
        vals = (email, phone, api_key, twToken, twPhone)
        for i in vals:
            if not i:
                self.display_err("Cannot have any blanks")
                return

        MsgBox = self.msg_confirmation('Are you sure you want SAVE this data?')			
        if MsgBox == "yes":
            qry = 'UPDATE Admin_Table SET email = "'+email+'", phone = '+phone+', api_key = "'+api_key+'", twphone = '+twPhone+', twToken = "'+twToken+'"'
            work_admin_db().execute_query_db(qry)
            self.get_db_data()
Ejemplo n.º 6
0
    def save_to_db(self, win, values):
        vid_rec = values['vid_rec']
        txt_vid_frames = values['txt_vid_frames']
        txt_vid_length = values['txt_vid_length']

        # Converts value of drop down box to either 1 or 0 to be stored in database.
        if vid_rec == 'Enabled':
            rec = 1
        else:
            rec = 0

        #-------------------VALIDATION-----------------------
        # Checks for blanks
        if not txt_vid_frames or not txt_vid_length:
            self.display_err("Text boxes cannot be blank.")
            return

        # Makes sure theres only numbers in the text box 1
        try:
            frames = int(txt_vid_frames)
        except:
            self.display_err("Only numbers allowed in the text boxes.")
            return

        # Makes sure theres only numbers in the text box 2
        try:
            vid_len = int(txt_vid_length)
        except:
            self.display_err("Only numbers allowed in the text boxes.")
            return
        #----------------------------------------------------

        # Runs query if validation passes
        MsgBox = self.msg_confirmation('Are you sure you want SAVE this data?')
        if MsgBox == "yes":
            qry = 'UPDATE Admin_Table SET video_enable = ' + str(
                rec) + ', video_res = ' + str(
                    frames) + ', video_length = ' + str(
                        vid_len) + ' WHERE id = 1'
            work_admin_db().execute_query_db(qry)
Ejemplo n.º 7
0
def send_twilio_msg(dest):

    msg = "Multimedia txt msg from Raspberry Pi 4."
    media_url = "/home/pi/Desktop/4pi/pics/picture.jpg"
    myIP = get('https://api.ipify.org').text

    db_data = work_admin_db().get_all_db()
    account_sid = db_data[0][10]
    auth_token = db_data[0][12]
    phone = db_data[0][11]

    client = Client(account_sid, auth_token)

    message = client.messages.create(to="+" + str(dest),
                                     from_="+" + str(phone),
                                     body=msg,
                                     media_url=myIP + media_url)
Ejemplo n.º 8
0
 def verify_old_pwd(self, pwd):
     admin_db = work_admin_db().search_pwd_db()
     if admin_db[0][0] == pwd:
         return True
     return False