[X2Go-Commits] pyhoca-gui.git - twofactorauth (branch) updated: 971504207b394d7ea064427b89072f01b6bd4ffd
X2Go dev team
git-admin at x2go.org
Sat Sep 14 15:54:17 CEST 2013
The branch, twofactorauth has been updated
via 971504207b394d7ea064427b89072f01b6bd4ffd (commit)
from 64e0edf77904253dfeb00a188b6696e7a3f4d3ff (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
pyhoca/wxgui/frontend.py | 28 +++++++++++++++-------------
pyhoca/wxgui/logon.py | 19 +++++++++++++++++--
2 files changed, 32 insertions(+), 15 deletions(-)
The diff of changes is:
diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py
index 536adfc..f952018 100644
--- a/pyhoca/wxgui/frontend.py
+++ b/pyhoca/wxgui/frontend.py
@@ -254,22 +254,27 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
"""
self.current_profile_name = self._eventid_profilenames_map[evt.GetId()]
session_uuid = self._X2goClient__register_session(profile_name=self.current_profile_name)
+
try:
- self._X2goClient__connect_session(session_uuid)
- self._post_authenticate(evt, session_uuid)
+ self._X2goClient__connect_session(session_uuid, add_to_known_hosts=True)
+ if not self._X2goClient__server_valid_x2gouser(session_uuid):
+ self.notifier.send('%s - connect failure' % self.current_profile_name, 'User is not allowed to start X2go sessions!', icon='session_warning', timeout=10000)
+ self._X2goClient__disconnect(session_uuid)
+ else:
+ self.notifier.send('%s - connect' % self.current_profile_name, 'Public SSH key authentication has been successful.', icon='auth_success', timeout=4000)
+ self._post_authenticate(evt, session_uuid)
except x2go.AuthenticationException:
+ self._pyhoca_logger('public SSH key authentication to server failed, trying next auth-mechanism', loglevel=x2go.log.loglevel_INFO, )
_logon_window = logon.PyHocaGUI_DialogBoxPassword(self, self.current_profile_name, caller=self )
self._sub_windows.append(_logon_window)
+ except x2go.SSHException, e:
+ self.notifier.send('%s - connect error' % self.current_profile_name, '%s!' % str(e), icon='auth_error', timeout=4000)
except gevent.dns.DNSError, e:
self.notifier.send('%s - connect error' % self.current_profile_name, '%s!' % e.strerror, icon='auth_error', timeout=4000)
except gevent.socket.error, e:
self.notifier.send('%s - connect error' % self.current_profile_name, '%s!' % e.strerror, icon='auth_error', timeout=4000)
-
- if self._X2goClient__is_session_connected(session_uuid):
- self.notifier.send('%s - connect' % self.current_profile_name, 'Public SSH key authentication has been successful.', icon='auth_success', timeout=4000)
- else:
- self._pyhoca_logger('public SSH key authentication to server failed, trying next auth-mechanism', loglevel=x2go.log.loglevel_INFO, )
-
+ except:
+ self.notifier.send('%s - connect error' % self.current_profile_name, 'An unknown error occurred!', icon='auth_error', timeout=4000)
def OnSessionStart(self, evt):
"""\
@@ -280,11 +285,8 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
_query_session = self._X2goClient__client_registered_sessions_of_name(self.current_profile_name)[0]
session_uuid = self._X2goClient__register_session(profile_name=self.current_profile_name)
if self._X2goClient__server_is_alive(session_uuid):
- if self._X2goClient__server_is_x2gouser(session_uuid):
- gevent.spawn(self._X2goClient__start_session, session_uuid)
- self.notifier.send(self.current_profile_name, 'New X2go session starting up...', icon='session_start', timeout=10000)
- else:
- self.notifier.send(self.current_profile_name, 'User is not allowed to start X2go sessions!', icon='session_warning_', timeout=10000)
+ gevent.spawn(self._X2goClient__start_session, session_uuid)
+ self.notifier.send(self.current_profile_name, 'New X2go session starting up...', icon='session_start', timeout=10000)
else:
self.notifier.send(self.current_profile_name, 'Paramiko/SSH session has died! Try to re-connect to the server.', icon='session_error', timeout=10000)
diff --git a/pyhoca/wxgui/logon.py b/pyhoca/wxgui/logon.py
index b373985..28b5b0a 100644
--- a/pyhoca/wxgui/logon.py
+++ b/pyhoca/wxgui/logon.py
@@ -168,8 +168,15 @@ class PyHocaGUI_DialogBoxPassword(wx.Dialog):
session_uuid = self._PyHocaGUI._X2goClient__client_registered_sessions_of_name(self.current_profile_name)[0].get_uuid()
try:
self._PyHocaGUI._X2goClient__connect_session(session_uuid, username=username, password=password, force_password_auth=True)
- self._PyHocaGUI._post_authenticate(evt, session_uuid)
- self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name,
+ print 'TEST: %s' % self._PyHocaGUI._X2goClient__server_valid_x2gouser(session_uuid)
+ if not self._PyHocaGUI._X2goClient__server_valid_x2gouser(session_uuid):
+ self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name,
+ title='%s - connect failure' % self.current_profile_name,
+ text='User is not allowed to start X2go sessions!',
+ icon='auth_error')
+ self._PyHocaGUI._X2goClient__disconnect(session_uuid)
+ else:
+ self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name,
title='%s - connect' % self.current_profile_name,
text='Authentication has been successful.',
icon='auth_success')
@@ -191,9 +198,17 @@ class PyHocaGUI_DialogBoxPassword(wx.Dialog):
title='%s - connect error' % self.current_profile_name,
text='%s!' % e.strerror,
icon='auth_error')
+ except:
+ self._PyHocaGUI.notifier.prepare('AUTH_%s' % self.current_profile_name,
+ title='%s - connect error' % self.current_profile_name,
+ text='An unknown error occured!',
+ icon='auth_error')
self._PyHocaGUI.notifier.send(self.current_profile_name, context='AUTH_%s' % self.current_profile_name, timeout=4000)
+ if self._PyHocaGUI._X2goClient__is_session_connected(session_uuid):
+ self._PyHocaGUI._post_authenticate(evt, session_uuid)
+
self.Destroy()
def OnCancel(self, evt):
hooks/post-receive
--
pyhoca-gui.git (Python X2Go Client (wxPython GUI))
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "pyhoca-gui.git" (Python X2Go Client (wxPython GUI)).
More information about the x2go-commits
mailing list