finally got login working properly