refactored redirect conditional to one line in authorize method