move admin login to func