#NEWLINE# @ waiting_effects #NEWLINE# def validatePage( self ) : #NEWLINE# #INDENT# if self . userPassRadioButton . isChecked ( ) : #NEWLINE# #INDENT# username = str ( self . field ( 'username' ) . toString ( ) ) #NEWLINE# password = str ( self . field ( 'password' ) . toString ( ) ) #NEWLINE# try : #NEWLINE# #INDENT# g = Github ( username , self ) #NEWLINE# user = g . get_user ( ) #NEWLINE# authentication = user . create_authorization ( scopes = [ 'repo' ] , note = 'test' ) #NEWLINE# #UNINDENT# except TwoFactorException : #NEWLINE# #INDENT# self . require_2fa = True #NEWLINE# return True #NEWLINE# #UNINDENT# except GithubException : #NEWLINE# #INDENT# self . require_2fa = False #NEWLINE# return False #NEWLINE# #UNINDENT# self . setField ( 'token' , str ( authentication . token ) ) #NEWLINE# self . require_2fa = False #NEWLINE# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if self . tokenRadioButton . isChecked ( ) : #NEWLINE# #INDENT# token = str ( self . field ( 'token' ) . toString ( ) ) #NEWLINE# try : #NEWLINE# #INDENT# self . setField ( 'username' , Github ( token ) . get_user ( ) . login ) #NEWLINE# #UNINDENT# except BadCredentialsException : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . require_2fa = False #NEWLINE# return True #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . require_2fa = False #NEWLINE# return False