for example: if I wanna do something after loopback-component-passport create the user,
and do other thing before the user login
I thought I can use remote hooks to get the timing I want.
like:
MyUser.afterRemote('create', function(context, instance, next) { // do something here next(); }); MyUser.beforeRemote('login', function(context, instance, next) { // do something here next(); });
I found out it didn't work.
so I use operation hook
MyUser.observe('after save', function(ctx, next) { if (ctx.instance) { // I can know it's a newly created user } else { // otherwise... } next(); });
But I still can't get any hint about when I can access before user login?
Did I miss something, or anyone has a better idea about doing the other way?
Diddn't loopback-component-passport use User.login, User.create?