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
(Created page with "=users\csLogin\TryLogin(string $sUser,string $sPass) : bool= ==About== * '''File''': {{l/ferreteria/code|login/status.php}} * '''Returns''': TRUE iff the submitted credentials...")
 
(doesn't make sense to link to the source file in each function; that should be in the class)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=users\csLogin\TryLogin(string $sUser,string $sPass) : bool=
{{fmt/title|<code>users\csLogin::TryLogin(string $sUser,string $sPass) : bool</code>}}
==About==
==About==
* '''File''': {{l/ferreteria/code|login/status.php}}
* '''Returns''': TRUE iff the submitted credentials are correct and there is no other reason to deny the login
* '''Returns''': TRUE iff the submitted credentials are correct and there is no other reason to deny the login
==Action==
==Action==
* checks credentials against account data for the requested login slug
* checks credentials against account data for the requested login slug
* if successful:
* 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):
* else (not successful):
===earlier notes to integrate===
** Set the internal login status: <code>csLogin::SetAccountStatus({{arg|results of search for login name}})</code>
** <code>$osAcct = $this->FindLoginName($sUser);</code>
** <code>FU\csLogin::SetAccountStatus($osAcct);</code>
** <code>$osrcAcct = $osAcct->Record();</code>
** If Record found:
*** $okMatch = does the password match?
*** <code>FU\csLogin::SetSuccess($okMatch,$sUser);</code>
** Else (if not found)
*** <code>FU\csLogin::SetSuccess(FALSE,$sUser);</code>
* Log the results (<code>$this->CreateEvent(...)</code>)
* On success:
** update the applicable Session record (<code>{{arg|Session Storage Row}}->UpdateForLogin($idAcct)</code>)
==History==
==History==
SRAL = <code>StorageRow()->AuthorizeLogin()</code>
SRAL = <code>StorageRow()->AuthorizeLogin()</code>
Line 15: Line 31:
* '''2022-03-17''' SRAL: PassMatches() is now a Card method, so $rc is now converted to a Card
* '''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''' adapting from session\cNativeRow->UserLogin()
* '''2022-03-18''' SRAL: The return value for this (cLoginStatus) is now a static class (csLoginStatus),
* '''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.
          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''' 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.
* '''2022-03-29''' Moving TryLogin() from the Account Feature to csLogin.

Latest revision as of 00:28, 23 June 2022

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

About

  • 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.