SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist TomTees's Avatar
    Join Date
    Apr 2010
    Location
    Iowa
    Posts
    553
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Allowing users to change Username...

    Like most modern websites, I would like the user's e-mail address to be their username/"primary key".

    The (obvious) problem is that a person's e-mail can change over time.

    Is it okay to use some system generated code for the (true) username/primary key, thus allowing users to change their e-mail address if need be?

    In such a scenario, I suppose the username/e-mail would be "indexed" to ensure uniqueness?

    Finally, if that is the way I went, would I have to worry about users changing their e-mail 20,000 times and thus creating a mess on the backend? (You would likely want to keep a history of each e-mail for contact and legal purposes.)



    TomTees

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,341
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    your idea of using a separate column as the primary key is very practical

    why not let the users choose a username?

    users don't change emails all that often, i don't think you have anything to worry about there
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Evangelist TomTees's Avatar
    Join Date
    Apr 2010
    Location
    Iowa
    Posts
    553
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937 View Post
    your idea of using a separate column as the primary key is very practical

    why not let the users choose a username?

    users don't change emails all that often, i don't think you have anything to worry about there
    I got into this debate MANY years ago. At the time, I thought letting users choose a username made more sense since it shouldn't ever change.

    However, the trend seems to be using e-mails. I suppose this is because an e-mail address is supposed to be unique - although this is increasingly less true. Also, because this is for an e-commerce site, the e-mail is THE way that you would communicate with users.

    I guess the common workflow is to let the user choose an e-mail for their username, send a test e-mail requiring activation of the account (i.e. authenticating the e-mail) and then going from their.

    Other than the database's need for a true primary key, I don't suppose you would ever use that in day-to-day activity, unless you could somehow label the primary key as "CustomerID" and start it offset at something like "100475" so that it looks authentic to the first user!


    TomTees

  4. #4
    SitePoint Evangelist TomTees's Avatar
    Join Date
    Apr 2010
    Location
    Iowa
    Posts
    553
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for answering my questions.


    TomTees


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •