'Perform user login.
:return: (user wants to exit,
github instance,
user\'s email)'

def _login_github(self, retry=3):

    invalid_login = False
    email = None
    while retry:
        retry -= 1
        dlg_cred = dlg_ask_credentials(invalid_login)
        (user_exit, method, params) = dlg_cred.run()
        dlg_cred.destroy()
        if user_exit:
            return (user_exit, None, None)
        if (method == dlg_ask_credentials.METHOD_GH):
            (user, password) = params
        elif (method == dlg_ask_credentials.METHOD_EMAIL):
            (user, password) = (OAUTH_TOKEN, None)
            email = params[0]
        else:
            (user, password) = (OAUTH_TOKEN, None)
        try:
            gh = GithubIssues(user, password)
            gh.login()
        except LoginFailed:
            invalid_login = True
            continue
        except OAuthTokenInvalid:
            dlg = dlg_invalid_token(self)
            dlg.run()
            dlg.destroy()
            return (True, None, None)
        else:
            break
    return (False, gh, email)
