getCurrentUser returns last added user
I am using backendless 4 in a js app for administering company staff. I am seeing what I think is unexpected behaviour, here is short summary:-
Admin of the app logs in: lets say that is me, Mike
Backendless.UserService.login(username, password, remember).then(userLoggedIn, gotError);
As expected the Backendless.UserService.getCurrentUser() will be 'Mike'
If 'Mike' then adds a new user via the app with soemthing like
var newuser = new Backendless.User();
newuser.name = "Fred";
newuser.email = "Fred@xyz.com"
newuser.password = "password";
Backendless.UserService.register( user ).then( userRegistered ).catch( gotError );
If I now call Backendless.UserService.getCurrentUser() then this returns the newly added user 'Fred'.
I had expected that getCurrentUser() would still be the logged in user 'Mike' ? Fred is simply added as a new user and not logged in.
Is this expected behaviour or am I misreading the docs or doing something wrong? If I shouldn't call getCurrentUser() to retrieve the current logged in user 'Mike', what backendless call should I make instead?