complete login manager

push other codes which i have forgotten last time.