changeset 1100:5976dcd42591

pages (g): use server's connect method to connect instead of bridge, this way normal Libervia workflow is used, and session attributes are initialised.
author Goffi <goffi@goffi.org>
date Fri, 01 Jun 2018 18:31:29 +0200
parents ea0d41ef3719
children 9f7a628ce893
files src/pages/g/page_meta.py src/server/server.py
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/pages/g/page_meta.py	Fri Jun 01 16:00:48 2018 +0200
+++ b/src/pages/g/page_meta.py	Fri Jun 01 18:31:29 2018 +0200
@@ -61,7 +61,7 @@
         profile = data['guest_profile']
         password = data['password']
         try:
-            yield self.host.bridgeCall("connect", profile, password, {})
+            yield self.host.connect(request, profile, password)
         except Exception as e:
             log.warning(_(u"Can't connect profile: {msg}").format(
                 msg=e))
@@ -71,7 +71,6 @@
 
         log.info(_(u"guest session started, connected with profile [{profile}]".format(
             profile = profile)))
-        sat_session.profile = profile
 
     # we copy data useful in templates
     template_data = request.template_data
--- a/src/server/server.py	Fri Jun 01 16:00:48 2018 +0200
+++ b/src/server/server.py	Fri Jun 01 18:31:29 2018 +0200
@@ -1643,7 +1643,11 @@
         if login.startswith('@'):
             raise failure.Failure(exceptions.DataError('No profile_key allowed'))
 
-        if '@' in login:
+        if login.startswith('guest@@') and login.count('@') == 2:
+            log.debug("logging a guest account")
+        elif '@' in login:
+            if login.count('@') != 1:
+                raise failure.Failure(exceptions.DataError('Invalid login: {login}'.format(login=login)))
             try:
                 login_jid = jid.JID(login)
             except (RuntimeError, jid.InvalidFormat, AttributeError):