modify login to deal with the case recover from crash

modify login to deal with the case recover from crash