Moved authentication to $user factory