Closed Bug 952063 Opened 11 years ago Closed 11 years ago

Trigger FxAccountsIACHelper 'onlogin', 'onloginverified' and 'onlogout' events when required

Categories

(Firefox OS Graveyard :: FxA, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
1.3 C3/1.4 S3(31jan)

People

(Reporter: ferjm, Assigned: ferjm)

References

Details

(Whiteboard: [qa?])

Attachments

(4 files, 4 obsolete files)

Component: Gaia → FxA
Assignee: nobody → ferjmoreno
Whiteboard: [qa?]
Fernando, should we also think about two onlogout events here? Where's My Fox needs to know when the user controlling the device has successfully logged out with authentication: https://bugzilla.mozilla.org/show_bug.cgi?id=952355 and of course, the user can be logged out because they failed authentication or because of some other error state.
Flags: needinfo?(ferjmoreno)
This bug is supposed to trigger events only for FxA manager apps (FTU and Settings so far), not for RPs. WMF is a RP and so we will need a different mechanism to notify about onlogout events as described in bug 952355. We talked about this during Madrid work week, but AFAICT we didn't decide how to notify RPs about FxA logouts. We mentioned different alternatives, like removing the authentication cookie or the possibility of using system messages. We'll need to work on this, but probably not in this bug.
Flags: needinfo?(ferjmoreno)
Depends on: 943521
Summary: Trigger FxAccountsIACHelper 'onlogin' and 'onverified' events when required → Trigger FxAccountsIACHelper 'onlogin', 'onloginverified' and 'onlogout' events when required
Attached patch Part 1: Add onverifiedlogin/onlogin (WIP) (obsolete) (deleted) — Splinter Review
Attached patch Part 2: B2G (WIP) (obsolete) (deleted) — Splinter Review
Attached patch Part 3: Gaia (WIP) (obsolete) (deleted) — Splinter Review
:ferjm great to see the WIP code. Some questions about it: * how should settings app code listen for changes? * what will the format of the data packet be? will you just send down the event name, or will you send down data with it? * what will be the event names? For an example of some client code, take a look at the event listener (lines 21-22) and the event handler (lines 27-48) here: https://github.com/6a68/gaia/blob/641c913/apps/settings/js/fxa_menu.js Thanks!
Flags: needinfo?(ferjmoreno)
(In reply to jhirsch from comment #6) > :ferjm great to see the WIP code. Some questions about it: > > * how should settings app code listen for changes? Via FxAccountsIACHelper.addEventListener(eventName, listener) > * what will the format of the data packet be? will you just send down the > event name, or will you send down data with it? There won't be any data passed to the event handlers. > * what will be the event names? > onlogin, onverifiedlogin and onlogout.
Flags: needinfo?(ferjmoreno)
Attached patch Part 3: Gaia (WIP) (obsolete) (deleted) — Splinter Review
Attachment #8360528 - Attachment is obsolete: true
Attached file Part 3: Gaia PR (deleted) —
This PR enables users of the FxAccountsIACHelper to subscribe/unsubscribe to events like 'onlogin', 'onverified' and 'onlogout' coming from the FxA platform implementation.
Attachment #8361696 - Flags: review?(alive)
Attached patch Part 3: Gaia Diff (deleted) — Splinter Review
I am also adding the diff, so you can use github or bugzilla for the review.
Attachment #8361112 - Attachment is obsolete: true
Mark, this patch does a s/fxaccounts:onlogin/fxaccounts:onverified for the notification that is triggered when the verification status changes from false to true and introduces a new fxaccounts:onlogin notification that is sent right after setting the signed in user even if it is an unverified account.
Attachment #8359917 - Attachment is obsolete: true
Attachment #8361701 - Flags: review?(mhammond)
Attached patch Part 2: B2G (deleted) — Splinter Review
Fabrice, this patch introduces the observers for the fxa notifications in the B2G fxa management service and does a s/mozFxAccountsRPChromeEvent/mozFxAccountsUnsolChromeEvent/g where "RP" used to mean Relying Party and "Unsol" stands for "unsolicited".
Attachment #8359918 - Attachment is obsolete: true
Attachment #8361703 - Flags: review?(fabrice)
Comment on attachment 8361701 [details] [diff] [review] Part 1: Add onverified/onlogin (WIP) Review of attachment 8361701 [details] [diff] [review]: ----------------------------------------------------------------- LGTM - I added the same notification in bug 956605, but this is a better place to fire it than I had in that bug. It's also going to make a couple other of my patches stale, but I can live with that.
Attachment #8361701 - Flags: review?(mhammond) → review+
ferjm - It just occurred to me that it might not be possible to tell, from the settings app, whether the user is logged out, or whether there is just no information locally. Is that right? getAccounts() would return `null` in either case? It might be worthwhile to differentiate the two states, to avoid showing users a logged-out state when they're already logged into the server, but the cache is cold. I'll know more after talking with UX next week about cold-cache edge cases.
Flags: needinfo?(ferjmoreno)
Comment on attachment 8361696 [details] Part 3: Gaia PR r+ but please see github comments.
Attachment #8361696 - Flags: review?(alive) → review+
Thanks Mark and Alive for the review! (In reply to jhirsch from comment #14) > ferjm - It just occurred to me that it might not be possible to tell, from > the settings app, whether the user is logged out, or whether there is just > no information locally. Is that right? getAccounts() would return `null` in > either case? > > It might be worthwhile to differentiate the two states, to avoid showing > users a logged-out state when they're already logged into the server, but > the cache is cold. I'll know more after talking with UX next week about > cold-cache edge cases. IMHO the concept of "logged-out account" does not make sense until we consider multi-account support. The platform does not save any information about previously logged accounts. When a logout is requested, we remove the server session and the local account information.
Flags: needinfo?(ferjmoreno)
Attachment #8361703 - Flags: review?(fabrice) → review+
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → 1.3 C3/1.4 S3(31jan)
Blocks: 949051
Blocks: 965492
No longer blocks: 965492
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: