If you’ve confirmed the username and password definitely work, but login is looping.
SSH to the computer.
Run ls -lah
.
If in the output the line you get:
-rw------- 1 root root 53 Nov 29 10:19 .Xauthority
then you need to do sudo chown username:username .Xauthority and try logging in.