Updated login functions