I have tested this issue on 3.1.2 & 3.2.0 and confirmed it exists in both versions.
1. Create a user with extra space in the admin console. (e.g 'tk1 ' or ' tk2')
2. Log out and try to log in with the usernames created above.
Unable to log in with the usernames.
I also found that the same issue was fixed in 2.1.6. (please refer https://issues.alfresco.com/jira/browse/ETWOONE-119)