consolidate login functionality