Login function implemented.