class TestSignup(unittest.TestCase): def setUp(self): self.user1 = Signup('daniel', 'nuwa', '*****@*****.**') self.user2 = Signup('jose', 'bugingo', '*****@*****.**') def test_class_created(self): self.assertIsInstance(self.user1, Signup) def test_combine_names(self): result = self.user1.combined_name() self.assertEqual(result, {'daniel nuwa'}) def test_submit(self): result = self.user1.submit() self.assertEqual(result, [{ 'first_name': 'daniel', 'last_name': 'nuwa', 'email': '*****@*****.**' }]) self.assertIsInstance(result, list) def test_validate_email(self): result = self.user1.validate_email('*****@*****.**') self.assertTrue(result) def test_validate_email_returns_false(self): result = self.user1.validate_email('daniel@gmailcom') self.assertFalse(result)
class Login(QWidget): def __init__(self,win_manager): super().__init__() self.wm=win_manager self.wm.add("login",self) self.db=wm.get_window("db") self.title = 'Log In' self.left = 350 self.top = 350 self.width = 340 self.height = 150 self.initUI() def initUI(self): self.setWindowTitle(self.title) self.setGeometry(self.left, self.top, self.width, self.height) grid_layout = QGridLayout() # Создаём QGridLayout self.setLayout(grid_layout) self.login_label=QLabel("Login:"******"Password:") self.password_field=QLineEdit() self.signup_btn = QPushButton('Sign Up', self) self.login_btn = QPushButton('Log In', self) grid_layout.addWidget(self.login_label,0,0) grid_layout.addWidget(self.login_field, 0, 1) grid_layout.addWidget(self.password_label, 1, 0) grid_layout.addWidget(self.password_field, 1, 1) grid_layout.addWidget(self.signup_btn,2,0) grid_layout.addWidget(self.login_btn, 2, 1) self.login_btn.clicked.connect(self.on_log_in_btn_cklick) self.signup_btn.clicked.connect(self.on_signup_btn_clicked) self.password_field.setEchoMode(QLineEdit.PasswordEchoOnEdit) self.show() def on_log_in_btn_cklick(self): login=self.login_field.text() password=self.password_field.text() account=self.db.auth(login,password) if account is None: self.error_dialog = QtWidgets.QErrorMessage() self.error_dialog.showMessage('Invalid login or password!') return self.setVisible(False) self.tabel=Lots(self.wm,account) def on_signup_btn_clicked(self): self.sg=Signup(self.wm) self.sg.show() self.setVisible(False)
class MainWindow(QMainWindow): def __init__(self): QMainWindow.__init__(self, None) self.login = Login() self.login.ui.signup_button.clicked.connect(self.register) self.setCentralWidget(self.login) self.signup = Signup() def register(self): self.signup.show()
def capture_register(self): self.show_facial_register_GUI_signal.emit() name_text = self.name_line.text() password_text = self.password_line.text() self.register_account_pwd_signal.emit(name_text, password_text) DATABASE = DB() signup = Signup() face, facecode = signup.get_face() DATABASE.registration(name_text, 'student', facecode, password_text) em = QErrorMessage(self) em.setWindowTitle("success") em.showMessage("Success!")
def on_signup_btn_clicked(self): if self.db is None: try: if 'db' not in self.wm.get_keys(): self.db=ServerAPI(self.ip_field.text(),int(self.port_field.text())) self.wm.add('db',self.db) else: self.db=self.wm.get_window('db') except: self.error_dialog = QtWidgets.QErrorMessage() self.error_dialog.showMessage('Invalid ip or port!') return self.sg=Signup(self.wm) self.sg.show() self.setVisible(False)
def __init__(self, master): Signup.__init__(self) Login.__init__(self) CREDIT.__init__(self) DEBIT.__init__(self) PROFILE.__init__(self) self.master = master() self.master.title('BANK Application') self.ws = self.master.winfo_screenwidth() self.hs = self.master.winfo_screenheight() self.master.wm_minsize(self.ws, self.hs) self.master.configure(background='#666666') self.menu_forget = False self.upd_pass = False self.upd_name = False
class Login(QDialog): def __init__(self): super(Login, self).__init__() loadUi('Log.ui', self) self.setWindowIcon(QIcon('Wallpaper/door.png')) self.setWindowTitle('Log In') self.val_2.setText('') self.pushButton.clicked.connect(self.on_pushButton_clicked) self.signupBtn.clicked.connect(self.on_signup) @pyqtSlot() def on_signup(self): from signup import Signup self.s = Signup() self.s.show() self.hide() @pyqtSlot() def on_pushButton_clicked(self): if str(self.n_txtbox.text()) == "": self.val_2.setText('Required User Name!') # vt.text2speech('Enter User Name') elif str(self.lineEdit_2.text()) == "": self.val_2.setText('Required Password!') # vt.text2speech('Enter Password') else: try: ref = db.reference('/user').child(self.n_txtbox.text()) self.u_name = ref.child('username').get() self.pas = ref.child('password').get() # print(self.u_name,self.pas) if (self.n_txtbox.text() == self.u_name) and (self.lineEdit_2.text() == self.pas): # print(self.n_txtbox.text(),self.lineEdit_2.text()) self.f = mainWindow() self.f.show() self.hide() else: self.val_2.setText('User Name OR Password Is Incorrect') # vt.text2speech('User Name OR Password Is Incorrect') except: self.val_2.setText('Network Error!')
def signup(): name = request.form['name'] email = request.form['email'] password = request.form['password'] if len(name) < 3: return json({"message": "Name length too short", "status_code": 303}) if '@' not in email or '.' not in email or len(email) < 9: return json({"message": "Email Invalid", "status_code": 303}) if len(password) < 8: return json({"message": "Password too short.", "status_code": 303}) return json({"data": Signup(name, email, password)})
def signup(self): try: print("signup") rname = self.rname.text() remail = self.remail.text() rph = self.rph.text() rpwd = self.rpwd.text() Signup.store(rname,remail,rph,rpwd) self.remail.setText("") self.rpwd.setText("") self.rph.setText("") self.rname.setText("") self.showAlertBox("Registration", "Registration Success") except Exception as e: print(e.args[0]) tb = sys.exc_info()[2] print(tb.tb_lineno)
def __init__(self, my_database, my_cursor): self.__my_database = my_database self.__my_cursor = my_cursor self.__start = Tk() self.__start.iconbitmap('icon.ico') self.__start.geometry('+'+str(round(self.__start.winfo_screenwidth()/2.25)) + "+" + str(round(self.__start.winfo_screenheight()/2.98))) Button(self.__start, text='Click to login the chat', command=lambda: Login(self.__start, self.__my_database, self.__my_cursor), cursor='hand2').grid(row=0) Button(self.__start, text='Click to signup the chat', command=lambda: Signup(self.__start, self.__my_database, self.__my_cursor), cursor='hand2').grid(row=1) self.__start.resizable(False, False) self.__client_name = '' self.__start.mainloop()
def signup(): #GUI of The signup page root.title("Signup") Label(frame, text="Username:"******"royalblue4", fg="grey85").grid(row=0, column=0) username = Entry(frame, width=30) username.grid(row=0, column=1, padx=20, pady=10) Label(frame, text="First Name:", bg="royalblue4", fg="grey85").grid(row=1, column=0) firstname = Entry(frame, width=30) firstname.grid(row=1, column=1, padx=20, pady=10) Label(frame, text="Last Name:", bg="royalblue4", fg="grey85").grid(row=2, column=0) lastname = Entry(frame, width=30) lastname.grid(row=2, column=1, padx=20, pady=10) Label(frame, text="Email:", bg="royalblue4", fg="grey85").grid(row=3, column=0) email = Entry(frame, width=30) email.grid(row=3, column=1, padx=20, pady=10) Label(frame, text="Password:"******"royalblue4", fg="grey85").grid(row=4, column=0) password = Entry(frame, width=30) password.grid(row=4, column=1, padx=20, pady=10) Button(frame, text="Signup", background="light blue", command=lambda: [ Signup.signup(username.get(), firstname.get(), lastname.get( ), email.get(), password.get()), username.delete(0, END), firstname.delete(0, END), lastname.delete(0, END), email.delete(0, END), password.delete(0, END) ]).grid(row=5, ipadx=100, columnspan=2) Button(frame, text="Go Back to Login", background="light blue", command=replace_signup).grid(row=6, columnspan=2, pady=10) root.mainloop()
def on_signup_btn_clicked(self): self.sg=Signup(self.wm) self.sg.show() self.setVisible(False)
def create(self): from signup import Signup self.widget.addWidget(Signup()) self.widget.setCurrentIndex(self.widget.currentIndex() + 1)
class Login(QWidget): def __init__(self,win_manager): super().__init__() self.wm=win_manager self.wm.add("login",self) self.db=None#self.wm.get_window("db") self.title = 'Log In' self.left = 350 self.top = 350 self.width = 340 self.height = 150 self.initUI() def initUI(self): self.setWindowTitle(self.title) self.setGeometry(self.left, self.top, self.width, self.height) grid_layout = QGridLayout() # Создаём QGridLayout self.setLayout(grid_layout) self.login_label=QLabel("Login:"******"Password:"******"ip:") self.ip_field = QLineEdit() self.ip_field.setText("127.0.0.1") self.port_label = QLabel("port:") self.port_field = QLineEdit() self.port_field.setText("8888") self.signup_btn = QPushButton('Sign Up', self) self.login_btn = QPushButton('Log In', self) grid_layout.addWidget(self.login_label,0,0) grid_layout.addWidget(self.login_field, 0, 1) grid_layout.addWidget(self.password_label, 1, 0) grid_layout.addWidget(self.password_field, 1, 1) grid_layout.addWidget(self.ip_label, 2, 0) grid_layout.addWidget(self.ip_field, 2, 1) grid_layout.addWidget(self.port_label, 3, 0) grid_layout.addWidget(self.port_field, 3, 1) grid_layout.addWidget(self.signup_btn,4,0) grid_layout.addWidget(self.login_btn, 4, 1) self.login_btn.clicked.connect(self.on_log_in_btn_cklick) self.signup_btn.clicked.connect(self.on_signup_btn_clicked) self.password_field.setEchoMode(QLineEdit.PasswordEchoOnEdit) self.show() def on_log_in_btn_cklick(self): login=self.login_field.text() password=self.password_field.text() if self.db is None: try: if 'db' not in self.wm.get_keys(): self.db=ServerAPI(self.ip_field.text(),int(self.port_field.text())) self.wm.add('db',self.db) else: self.db=self.wm.get_window('db') except: self.error_dialog = QtWidgets.QErrorMessage() self.error_dialog.showMessage('Invalid ip or port!') return try: account=self.db.auth(login,password) except: self.error_dialog = QtWidgets.QErrorMessage() self.error_dialog.showMessage("Some error in auth!(") return if account is None: self.error_dialog = QtWidgets.QErrorMessage() self.error_dialog.showMessage('Invalid login or password!') return self.setVisible(False) self.main_win=Main_win(self.wm,account) def on_signup_btn_clicked(self): if self.db is None: try: if 'db' not in self.wm.get_keys(): self.db=ServerAPI(self.ip_field.text(),int(self.port_field.text())) self.wm.add('db',self.db) else: self.db=self.wm.get_window('db') except: self.error_dialog = QtWidgets.QErrorMessage() self.error_dialog.showMessage('Invalid ip or port!') return self.sg=Signup(self.wm) self.sg.show() self.setVisible(False)
def on_signup(self): from signup import Signup self.s = Signup() self.s.show() self.hide()
def setUp(self): self.user1 = Signup('daniel', 'nuwa', '*****@*****.**') self.user2 = Signup('jose', 'bugingo', '*****@*****.**')
def open_signup(self): self.uiSign = Signup()
from signup import Signup from user import User menu = Signup() if __name__ == '__main__': menu.Interface()