If we create a new user first and assign the groups and roles to it later, the "New user" will not be able to login. However if we assign the groups and roles while creating the user, there is no issue.
Steps to reproduce:
1. Go to admin page > Users
2. Click new user and provide the username
3. Click on "Create" button
4. Set the password
5. Now the user will be created, add groups and roles to it.
6. Try to login with the new user.