Duplicate login fixes

Fix the logic bugs for the not allow duplicate login