Bug Fix Part I.
After the user has logged in, the nickname is generated by the server.
At this point, the server needs to check whether it already has this nickname in the DB. If it does, it needs to return a unique nickname. If not, the nickname generated by splicing the email ID is fine.
The uniqueness is maintained by adding a counter to the nickname and checking the DB if this nickname exists. Eventually we get a unique nick.