def reset(self,button): email = self.builder.get_object("email") # get the value from the field db = sqlite3.connect('SaedRobot.db') c = db.cursor() # query the DB if such an email exist c.execute('SELECT * from users WHERE email=?' , (email.get_text(),)) row=c.fetchone() # check+send the new password if row != None and len(row)>0: username = row[0] randPassword= id_generator() c = db.cursor() c.execute("update users set password=? where username=?" , (randPassword,username,)) db.commit() send_email(randPassword,username,"Saed Robot - Reset your password",email.get_text() ) dialog=Gtk.MessageDialog(None,0,Gtk.MessageType.INFO,Gtk.ButtonsType.OK,"Your new password has been sent to your email") dialog.set_title("Confirmation message") dialog.run() dialog.close() self.window.destroy() self.window=login.loginClass() # show error message if no such email exists else: dialog=Gtk.MessageDialog(None,0,Gtk.MessageType.ERROR,Gtk.ButtonsType.OK,"Invalid entry, please try again") dialog.set_title("Error message") dialog.run() dialog.close()
def onLogoutButtonPressedButtonPressed(self, button): self.window.destroy() self.window=login.loginClass()
def Core(): driver = webdriver.Chrome() return driver a = [] def store(a): data = {} if (len(a) == 5): data['result'] = a with open('result.json', 'w') as outfile: json.dump(data, outfile) if __name__ == "__main__": driver = Core() registration_result = registration.registrationClass().registrationForm( driver) a.append(registration_result) hotel_result = hotelBooking.hotelClass().hotelForm(driver) a.append(hotel_result) flight_result = flightBooking.flightClass().flightForm(driver) a.append(flight_result) car_book_result = carBooking.carClass().carForm(driver) a.append(car_book_result) login_result = login.loginClass().login(driver) store(a)
#!/usr/bin/python ######################################################################## # written by : Najla AlGhofaili, CS, # # Imam Abdulrahman AlFaisal University # #----------------------------------------------------------------------# # # # This is the file where the application will start from # # It is linked with the login interface # # # ######################################################################## import sqlite3 from common import id_generator, send_email import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk import login window = login.loginClass() Gtk.main()
def logout(self, button, a): self.window.destroy() self.window = login.loginClass()