示例#1
0
def logInPavlovia(parent, event=None):
    """Opens the built-in browser dialog to login to pavlovia

    Returns
    -------
    None (user closed window without logging on) or a gitlab.User object
    """
    # check known users list
    dlg = PavloviaMiniBrowser(parent=parent, loginOnly=True)
    dlg.ShowModal()  # with loginOnly=True this will EndModal once logged in
    if dlg.tokenInfo:
        token = dlg.tokenInfo['token']
        pavlovia.login(token, rememberMe=True)  # log in to the current pavlovia session
        return pavlovia.getCurrentSession().user
示例#2
0
def logInPavlovia(parent, event=None):
    """Opens the built-in browser dialog to login to pavlovia

    Returns
    -------
    None (user closed window without logging on) or a gitlab.User object
    """
    # check known users list
    dlg = PavloviaMiniBrowser(parent=parent, loginOnly=True)
    dlg.ShowModal()  # with loginOnly=True this will EndModal once logged in
    if dlg.tokenInfo:
        token = dlg.tokenInfo['token']
        pavlovia.login(token, rememberMe=True)  # log in to the current pavlovia session
        return pavlovia.getCurrentSession().user
示例#3
0
        def onSelectUser(evt):
            # Get user from menu
            id = evt.Id
            menu = evt.EventObject
            user = menu.users[id]
            # Logout
            pavlovia.logout()
            # Log back in as new user
            pavlovia.login(user['username'])
            # Update view
            self.user = pavlovia.getCurrentSession().user
            # Update cache
            prefs.appData['projects']['pavloviaUser'] = user['username']

            self.Layout()  # update the size of the button
            self.Fit()
示例#4
0
 def checkForLoginURL(self, event):
     url = event.GetURL()
     if 'access_token=' in url:
         self.tokenInfo['token'] = self.getParamFromURL('access_token', url)
         self.tokenInfo['tokenType'] = self.getParamFromURL(
             'token_type', url)
         self.tokenInfo['state'] = self.getParamFromURL('state', url)
         self._loggingIn = False  # we got a log in
         self.browser.Unbind(wx.html2.EVT_WEBVIEW_LOADED)
         pavlovia.login(self.tokenInfo['token'])
         if self.loginOnly:
             self.EndModal(wx.ID_OK)
     elif url == 'https://gitlab.pavlovia.org/dashboard/projects':
         # this is what happens if the user registered instead of logging in
         # try now to do the log in (in the same session)
         self.login()
     else:
         logging.info("OAuthBrowser.onNewURL: {}".format(url))
示例#5
0
 def checkForLoginURL(self, event):
     url = event.GetURL()
     if 'access_token=' in url:
         self.tokenInfo['token'] = self.getParamFromURL(
             'access_token', url)
         self.tokenInfo['tokenType'] = self.getParamFromURL(
             'token_type', url)
         self.tokenInfo['state'] = self.getParamFromURL(
             'state', url)
         self._loggingIn = False  # we got a log in
         self.browser.Unbind(wx.html2.EVT_WEBVIEW_LOADED)
         pavlovia.login(self.tokenInfo['token'])
         if self.loginOnly:
             self.EndModal(wx.ID_OK)
     elif url == 'https://gitlab.pavlovia.org/dashboard/projects':
         # this is what happens if the user registered instead of logging in
         # try now to do the log in (in the same session)
         self.login()
     else:
         logging.info("OAuthBrowser.onNewURL: {}".format(url))