Similar problem happened to my friend because somehow he corrupted the .Xautority file.
Log into a tty (Control+Alt+F6) and after typing your username and password:
sudo rm -v .Xauthority
.Xauthority file can be found in /home/, which is where the terminal’s default working path also usually is. If you use a tty to sign in as one user to delete another’s .Xauthority file, make sure you’ve cd’d to the right directory first.
Then restart lightdm with:
sudo service lightdm restart
The system will recreate the .Xautority file. Hope it helps.