From 9daef2c2dcc53fdec359351007d79a92e8d6edef Mon Sep 17 00:00:00 2001 From: Lloyd Hilaiel <lloyd@hilaiel.com> Date: Mon, 12 Mar 2012 13:14:01 -0600 Subject: [PATCH] upon return from session context with a set userid, remember that the user has used browserid on this computer so the next time we can ask them if they'd like to stay signed in. --- resources/static/shared/network.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/static/shared/network.js b/resources/static/shared/network.js index be58ccc31..c00f33e66 100644 --- a/resources/static/shared/network.js +++ b/resources/static/shared/network.js @@ -17,7 +17,8 @@ BrowserID.Network = (function() { mediator = bid.Mediator, xhr = bid.XHR, post = xhr.post, - get = xhr.get; + get = xhr.get, + storage = bid.Storage; function onContextChange(msg, result) { context = result; @@ -29,6 +30,12 @@ BrowserID.Network = (function() { auth_status = result.auth_level; code_version = result.code_version; + // when session context returns with an authenticated user, update localstorage + // to indicate we've seen this user on this device + if (result && result.userid) { + storage.usersComputer.setSeen(result.userid); + } + // seed the PRNG // FIXME: properly abstract this out, probably by exposing a jwcrypto // interface for randomness -- GitLab