Fix avatar display for users with underscore (fixes #811)

Contrary to the validation notice, it is possible to create user with an
underscore in the username. However when doing so, the avatar wasn't
shown due to a route matching issue.

In order to avoid that, this commit changes the avater URL to use the
user id instead of the username. This results in less nice avatar image
urls, but this doesn't really matter much.