-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added afterLogout trigger #6217
added afterLogout trigger #6217
Conversation
Notes:
|
Codecov Report
@@ Coverage Diff @@
## master #6217 +/- ##
==========================================
- Coverage 93.82% 93.81% -0.02%
==========================================
Files 167 167
Lines 11293 11302 +9
==========================================
+ Hits 10596 10603 +7
- Misses 697 699 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few comments.
Is this true? |
@dplewis Yes, the session object is deleted from the DB and returned here. If there was any session object to delete. See |
Oh i see from the tests. Would I get the user? |
@dplewis Yes, you can get the user, if there was a user associated with the session. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@dplewis I just noticed that in the tests I do not get the user from the session. The session object only looks like this: There seem to be fields missing, do you know why? I do however get the whole session object incl. the user in a development environment setup. |
It is an object that extends ParseObject. I assume you can do req.object.get(“user”) and fetch the user. Can you add it to the tests. |
Oh you are right, that works. I just didn't see it in the console log. I will add this to the tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super nice @mtrezza
Thanks all for the fast review 🚀 |
* added afterLogout trigger * added verification of session object in tests * removed obsolete code * removed unsued code * improved tests to verify user ID
Sorry for pulling up this old thread but is there a reason for |
Analogous to the existing
beforeLogin
trigger, thisafterLogout
trigger can be used to perform certain clean-up actions upon user logout.The
afterLogout
trigger contains the_Session
object that was deleted. Usually, a session object contains a pointer to a_User
object with which the session is associated. With that, actions can be taken for the specific user that logged out.Caveat:
The
afterLogout
is only triggered when a session object was deleted upon logout. If a user logs out but there is not session object to be deleted, theafterLogout
trigger is not called. This is by design, because without a session object to determine who logged out, theafterLogout
trigger does not seem useful.