diff options
author | Tulio Casagrande <tcasagra@thoughtworks.com> | 2017-02-10 16:18:03 -0200 |
---|---|---|
committer | Tulio Casagrande <tcasagra@thoughtworks.com> | 2017-02-10 16:28:45 -0200 |
commit | 00f35893e37ec8cec8a0cb10b41400ad7e782ed5 (patch) | |
tree | c027b04391bf5197f17739af576156d81f2244f7 /service | |
parent | 8639b2ce3fa922cdb0871235d3791ab0fb65e810 (diff) |
[#907] Change interstitial to query for new status resource
with @akanim
Diffstat (limited to 'service')
-rw-r--r-- | service/pixelated/assets/Interstitial.js | 6 | ||||
-rw-r--r-- | service/pixelated/resources/login_resource.py | 13 |
2 files changed, 16 insertions, 3 deletions
diff --git a/service/pixelated/assets/Interstitial.js b/service/pixelated/assets/Interstitial.js index ac5a789a..cda56a4b 100644 --- a/service/pixelated/assets/Interstitial.js +++ b/service/pixelated/assets/Interstitial.js @@ -1,7 +1,7 @@ if ($('#hive').length) { var hive = new Snap('#hive'); var img_width = $('#hive').width(); - var left_pos = img_width * .5; + var left_pos = img_width * 0.5; var pixelated = hive.path("M12.4,20.3v31.8l28,15.8l28-15.8V20.3l-28-15.8L12.4,20.3z M39.2,56.4l-16.3-9V27.9l16.3,9.3L39.2,56.4z M57.7,47.4l-16.1,9l0-19.2l16.1-9.4V47.4z M57.7,25.2L40.4,35.5L22.9,25.2l17.5-9.4L57.7,25.2z").transform("translate(319, 50)").attr("fill", "#908e8e"); var all = hive.group().transform("matrix(2, 0, 0, 2, -100, -100)"); @@ -42,9 +42,9 @@ $(function () { var handler = setInterval(function () { $.ajax({ method: 'GET', - url: '/' + url: '/login/status' }).success(function (data) { - if (/Pixelated Mail/g.test(data)) { + if (data === 'completed' || data === 'error') { window.location="/"; } }); diff --git a/service/pixelated/resources/login_resource.py b/service/pixelated/resources/login_resource.py index 74369605..2a9be77b 100644 --- a/service/pixelated/resources/login_resource.py +++ b/service/pixelated/resources/login_resource.py @@ -106,6 +106,8 @@ class LoginResource(BaseResource): return self if path == 'login': return self + if path == 'status': + return LoginStatusResource(self._services_factory) if not self.is_logged_in(request): return UnAuthorizedResource() return NoResource() @@ -164,3 +166,14 @@ class LoginResource(BaseResource): d = self._bootstrap_user_services.setup(user_auth, password, language) d.addCallback(set_session_cookies, session) d.addErrback(login_error, session) + + +class LoginStatusResource(BaseResource): + isLeaf = True + + def __init__(self, services_factory): + BaseResource.__init__(self, services_factory) + + def render_GET(self, request): + session = IPixelatedSession(request.getSession()) + return format(session.check_login_status()) |