Ferreteria/v0.5/login/submit

From Woozle Writes Code
< Ferreteria‎ | v0.5‎ | login
Jump to navigation Jump to search

Process

This happens when the user submits a username and password.

  • Search for username in the Accounts table.
  • If found:
    • Check password match
    • If matched:
      • (login conditions satisfied for now -- though eventually we'll want to check account status in case it is suspended (not yet supported))
      • Find/create Session record for user's browser
      • Session bookkeeping: (a) save Account ID, (b) update WhenUsed
      • Account bookkeeping: update WhenLogin
      • Login object bookkeeping: (a) save Session and Account; (b) note success
      • Event log: successful login
    • Else (if not matched)
      • Login object bookkeeping: (a) save Account; (b) note failure
      • Event log: failed login, bad pw
  • Else (if not found)
    • Login object bookkeeping: note login-failed
    • Event log: failed login, unknown user

Code

Template:L/ver/method($sUser,$sPass)}} : handle the logic for user login attempt; do necessary bookkeeping for result