Ejemplo n.º 1
0
	def _login_by_user(self):
		"""
		@note This must be run outside of the UI lock
		"""
		loggedIn, (username, password) = False, self._credentials
		tmpServiceId = self.GV_BACKEND
		while not loggedIn:
			with gtk_toolbox.gtk_lock():
				credentials = self._credentialsDialog.request_credentials(
					defaultCredentials = self._credentials
				)
				banner = hildonize.show_busy_banner_start(self._window, "Logging In...")
			try:
				username, password = credentials
				loggedIn = self._phoneBackends[tmpServiceId].login(username, password)
			finally:
				with gtk_toolbox.gtk_lock():
					hildonize.show_busy_banner_end(banner)

		if loggedIn:
			serviceId = tmpServiceId
			self._credentials = username, password
			_moduleLogger.info("Logged into %r through user request" % self._phoneBackends[serviceId])
		else:
			# Hint to the user that they are not logged in
			serviceId = self.NULL_BACKEND
			self._notebook.set_current_page(self.ACCOUNT_TAB)

		return loggedIn, serviceId
Ejemplo n.º 2
0
	def _attempt_login(self, force = False):
		"""
		@note This must be run outside of the UI lock
		"""
		try:
			assert self._initDone, "Attempting login before app is fully loaded"

			serviceId = self.NULL_BACKEND
			loggedIn = False
			if not force and self._defaultBackendId != self.NULL_BACKEND:
				with gtk_toolbox.gtk_lock():
					banner = hildonize.show_busy_banner_start(self._window, "Logging In...")
				try:
					self.refresh_session()
					serviceId = self._defaultBackendId
					loggedIn = True
				except Exception, e:
					_moduleLogger.exception('Session refresh failed with the following message "%s"' % str(e))
				finally:
					with gtk_toolbox.gtk_lock():
						hildonize.show_busy_banner_end(banner)