Ferreteria/v0.5/@cls/login/login/trylogin: Difference between revisions
< Ferreteria | v0.5 | @cls | login | login
Jump to navigation
Jump to search
m (Woozle moved page Ferreteria/v0.5/@cls/login/login/TryLogin() to Ferreteria/v0.5/@cls/login/login/trylogin without leaving a redirect: for compatibility with l/ver) |
(doesn't make sense to link to the source file in each function; that should be in the class) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
{{fmt/title|<code>users\csLogin::TryLogin(string $sUser,string $sPass) : bool</code>}} | |||
==About== | ==About== | ||
* '''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== |
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);
- 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 (
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.