Odyssey
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
UserLogin Class Reference

Public Member Functions

 __construct (User $user, CuAdmin $cuAdmin, $cookie_prefix='usr')
 
 IsAccountLocked ()
 
 IsValidDeviceCookie ($cu)
 
 IsValidMammothDeviceCookie ($cu, $hbenv)
 
 SetLoginDeviceCookie ($hbenv)
 
 CreateSessionTicket ($hbenv, $mc, $cu)
 
 ValidateUser ($password='', $remember_me=false)
 
 IsMFAMode ()
 

Public Attributes

 $new_user = false
 
 $errors = NULL
 

Private Member Functions

 UpdateMammothDeviceCookie ($cu, $hbenv, $mammothCookieName)
 

Private Attributes

 $cu = NULL
 
 $cookie_prefix = ''
 

Detailed Description

PHP User Login Class

Handles username and password validation, challenge questions, etc.

Written: 10/2019

Definition at line 12 of file UserLogin.php.

Member Function Documentation

◆ CreateSessionTicket()

UserLogin::CreateSessionTicket (   $hbenv,
  $mc,
  $cu 
)

CreateSessionTicket

Definition at line 240 of file UserLogin.php.

240  {
241  $hbenv['cu'] = $cu;
242  $hbenv['platform'] = $hbenv['platform'];
243  $hbenv['Uid'] = $this->user->data['user_id'];
244  $hbenv['Cn'] = $this->user->data['user_name'];
245  $hbenv['Ce'] = time() + $hbenv['SYSENV']['ticket']['expires'];
246  $hbenv['Clw'] = $this->cuAdmin->admininfo['livewait'];
247  $hbenv['Clu'] = (empty($this->user->data['lastupdate']) ? $mc->msg("Unknown") : urlencode(trim($this->user->data['lastupdate'])));
248  $hbenv['lastupdate'] = (empty($this->user->data['lastupdate']) ? "Unknown" : urlencode(trim($this->user->data['lastupdate'])));
249  $hbenv['Fplog'] = (empty($this->user->data['llog']) ? $mc->msg("None") : urlencode(trim($this->user->data['llog'])));
250  $hbenv['Fflog'] = (empty($this->user->data['flog']) ? $mc->msg("None") : urlencode(trim($this->user->data['flog'])));
251  $hbenv['Ffchg'] = (is_null($this->user->data['fchange']) ? 'N' : $this->user->data['fchange']);
252  $hbenv['Ffremain'] = (is_null($this->user->data['fremain']) || $this->user->data['fremain'] == 0 ? $this->cuAdmin->admininfo['grace'] : $this->user->data['fremain']);
253  $hbenv['Fmsg_tx'] = $this->user->data['msg_tx'];
254  $hbenv['Fset'] = $this->cuAdmin->admininfo['flagset'];
255  $hbenv['Fset2'] = $this->cuAdmin->admininfo['flagset2'];
256  $hbenv['Fset3'] = $this->cuAdmin->admininfo['flagset3'];
257  $hbenv['Fhdays'] = $this->cuAdmin->admininfo['fhdays'];
258  $hbenv['Ml'] = $this->user->data['email'];
259  $hbenv['Ffreset'] = $this->user->data['freset'];
260 
261  // * Add this for use later possibly in 2Factor cookie
262  $hbenv['savepass'] = $this->user->data['passwd'];
263  $hbenv['savemail'] = $this->user->data['email'];
264 
265  // Set the sid at this point. It is not updated from this point.
266  $hbenv["sid"] = strval(time());
267  // SET THE MEMBER COOKIE
268  $now = time();
269 
270  $baseCookie = BuildBaseSessionTicket($hbenv);
271  $mycookie = "Ctime=$now&Cn={$this->user->data['user_name']}&Uid={$this->user->data['user_id']}&Ml=" . urlencode($this->user->data['email']) . "&Ca=";
272 
273  // ** Check for testmenu param -- If set to 1, then I want to add it to cookie
274  // if (intval(HCU_array_key_value('testmenu', $hbenv['HCUPOST'])) == 1) {
275  // $mycookie .= "&testmenu=1";
276  // }
277  // ** SET THE COOKIE
278  SetTicket($hbenv, $baseCookie, $mycookie);
279  }

The documentation for this class was generated from the following file: