refactor nil to method
refactor controller login logic