Ferreteria/v2/usage/login
< Ferreteria | v2 | usage
Jump to navigation
Jump to search
Data
This uses essentially the same tables as VbzCart/tables#Users -- documentation to be moved here eventually.
Code
clsPageLogin (see pages): <php>
protected function DoLoginCheck() {
$this->App()->Session()->UserLogin($this->LoginName(),$this->sPass);
}
</php> clsUserSession: <php>
/*---- ACTION: Attempts to log the user in with the given credentials. RETURNS: user object if successful, NULL otherwise. */ public function UserLogin($iUser,$iPass) {
$tUsers = $this->UserTable(); $oUser = $tUsers->Login($iUser,$iPass); $this->SetUserRecord($oUser); // set user for this session
}
</php> clsUserAccts: <php>
/*---- RETURNS: user object if login successful, NULL otherwise */ public function Login($iUser,$iPass) {
$rc = $this->FindUser($iUser); if (is_null($rc)) { // username not found $oUser = NULL; } elseif ($rc->AuthValid($iPass)) { $oUser = $rc; } else { // username found, password wrong $oUser = NULL; } return $oUser;
}
</php>