Login callbacks?
-
Feature request: can you add login callbacks?
Here’s my use case. I’m using javascript analytics packages (Mixpanel via the Segment wordpress plugin). Out of the box, that plugin handles identifying users via normal login, but not login with ajax.
I’m thinking I can imperfectly handle this by watching for the
lwa_login
event, just like is already done in the login-with-ajax source:$(document).on('lwa_login', function(event, data, form) { // My analytics identify() code here... }
The problem is because of login-with-ajax’s immediate redirect/reload, this doesn’t allow a potentially long-running operation to take place. Normally the analytics
identify()
method is very quick, but it’s a network call so might take longer.What I’d really like is to provide login-with-ajax a callback, where I can control when the redirect happens. Perhaps like so:
LoginWithAjax.configure({ login: { success: function(callback) { // Make analytics call here. Then when done: callback(); // which would continue the login-with-ajax logic } } });
I suppose in the meantime I could make use of the
Disable refresh upon login?
to disable auto-refreshing, and then redirect/reload myself. But a callback would be much cooler ??
- The topic ‘Login callbacks?’ is closed to new replies.