Redmine#4719 validating user name both forr classic and TLS protocol.

If there are some characters in the user name we assume is invalid
connection with the client is terminated.