Ferreteria/v0.5/@cls/login/login/trylogin: Difference between revisions

From Woozle Writes Code
< Ferreteria‎ | v0.5‎ | @cls‎ | login‎ | login
Jump to navigation Jump to search
No edit summary
m (3 revisions imported: moving this project here)
(No difference)

Revision as of 16:44, 22 May 2022

users\csLogin\TryLogin(string $sUser,string $sPass) : bool

About

  • File: login/status.php
  • Returns: TRUE iff the submitted credentials are correct and there is no other reason to deny the login

Action

  • checks credentials against account data for the requested login slug
  • if successful:
    • finds/creates a Session for the user's client (browser)
    • sets Session:Account_ID to the ID of the matching account
    • logs the successful login
  • else (not successful):

earlier notes to integrate

    • Set the internal login status: csLogin::SetAccountStatus(<results of search for login name>)
    • $osAcct = $this->FindLoginName($sUser);
    • FU\csLogin::SetAccountStatus($osAcct);
    • $osrcAcct = $osAcct->Record();
    • If Record found:
      • $okMatch = does the password match?
      • FU\csLogin::SetSuccess($okMatch,$sUser);
    • Else (if not found)
      • FU\csLogin::SetSuccess(FALSE,$sUser);
  • Log the results ($this->CreateEvent(...))
  • On success:
    • update the applicable Session record (<Session Storage Row>->UpdateForLogin($idAcct))

History

SRAL = StorageRow()->AuthorizeLogin()

  • 2020-01-10 SRAL: Rewriting began several days ago.
  • 2021-01-16 SRAL: removed $osLogin->SetAccountRecord(TRUE,$rc) after "$rc =" because it's now redundant
  • 2022-02-10 SRAL: moved from Feature to Storage Row
  • 2022-03-17 SRAL: PassMatches() is now a Card method, so $rc is now converted to a Card
  • 2022-03-18 adapting from session\cNativeRow->UserLogin()
  • 2022-03-18 SRAL: The return value for this (cLoginStatus) is now a static class (csLoginStatus), so there's no point in returning it. Will instead return a bool indicating success/failure.
  • 2022-03-29 SRAL: It no longer makes sense to me to have this routine handle bookkeeping; it should do the minimum necessary and get out. It's probably duplicating functionality. ...and most of what we need is in SRAL:FindLoginName() -- so let's just consolidate this back into the only thing that calls it: Feature->TryLogin()
  • 2022-03-29 Moving TryLogin() from the Account Feature to csLogin.