Refactor local user login