Ferreteria/v0.5/login/submit
< 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
<Account Feature>->TryLogin($sUser,$sPass)
: handle the logic for user login attempt; do necessary bookkeeping for result
- →
<Account Storage Row>->AuthorizeLogin($sUser,$sPass)
: lookup the given username, see if the password hash matches the stored hash- Set the internal login status:
csLogin::SetAccountStatus(<results of search for login name>)
- Set the internal login status:
- Log the results (
$this->CreateEvent(...)
) - On success:
- update the applicable Session record (
<Session Storage Row>->UpdateForLogin($idAcct)
)
- update the applicable Session record (