5 require_once(
'hcuCommon.i');
10 const MEM_FORCE_RESET = 2;
11 const MEM_LOGIN_FAILED_EMAIL = 4;
12 const MEM_LOGIN_FAILED_QST = 8;
13 const MEM_LOGIN_FAILED_PWD = 16;
14 const MEM_ASKBPAY = 32;
15 const MEM_LOGIN_FAILED_ALIAS = 64;
16 const MEM_LOGIN_FAILED_SAC = 128;
17 const MEM_LOGIN_FAILED_BNDL = 256;
18 const MEM_LOGIN_FAILED_BNDL_TIMEOUT = 512;
19 const MSGTX_TRANSFER = 1;
21 const MSGTX_WEBCONNECT = 4;
22 const MSGTX_TMP_SURVEY = 8;
23 const MSGTX_TMP_XAC_RQ = 16;
24 const MSGTX_TMP_XAX_LD = 32;
25 const MSGTX_INTUITUPD = 64;
26 const MSGTX_TXNDOWN = 128;
27 const MSGTX_TMP_MKT = 256;
28 const MSGTX_FORCE_EM = 512;
29 const MSGTX_PASSCHG = 1024;
30 const MSGTX_ONLINEDISC = 2048;
31 const MSGTX_PROMOHIDE = 4096;
32 const MSGTX_STICKY = 8192;
33 const HCUTEMP_FLAGS = 49464;
39 private $dirtyFields = [];
41 private $allowedProperties = [
60 private $derivedProperties = [
63 public $isUserLoaded =
false;
72 if (!strlen($username) || preg_match(
"/[\\\`,\"\s;]/", $username)) {
73 throw new Exception(static::class .
": invalid username [$username]");
76 if (!strlen($creditUnion)) {
77 throw new Exception(static::class .
": invalid credit union [$cu]");
80 if (!$userRepo instanceof
UserRepo) {
81 throw new Exception(static::class .
": need instance of UserRepo");
83 $this->username = $username;
84 $this->creditUnion = $creditUnion;
85 $this->userRepo = $userRepo;
96 public function __get(
string $propertyName) {
97 if (in_array($propertyName, array_merge($this->allowedProperties, $this->derivedProperties))) {
98 return $this->data[$propertyName] ??
null;
100 throw new Exception(static::class .
": Property [$propertyName] does not exist.");
112 public function __set(
string $propertyName,
string $value) {
113 if (in_array($propertyName, array_merge($this->allowedProperties))) {
114 $this->data[$propertyName] = $value;
115 $this->dirtyFields[] = $propertyName;
117 throw new Exception(static::class .
": Property [$propertyName] does not exist.");
128 public function __isset(String $propertyName) {
129 return !empty($this->data[$propertyName]);
138 $this->data = $this->userRepo->Read($this->username);
141 throw new Exception(static::class .
": Invalid user '$this->username' for credit union {$this->creditUnion}.");
143 $this->isUserLoaded =
true;
145 $this->data[
'mfaquest'] = $this->
DecodeMFAJson(HCU_JsonDecode($this->data[
'mfaquest']));
146 $this->data[
'freset'] = $this->userflags & static::MEM_FORCE_RESET;
165 'mfacount' => HCU_array_key_exists(
'answers', $mfaJson) ? count($mfaJson[
'answers']) : 0,
166 'answers' => HCU_array_key_exists(
'answers', $mfaJson) ?? [],
167 'challenge' => HCU_array_key_exists(
'challenge', $mfaJson) ? intval($mfaJson[
'challenge']) : 0,
168 'authcode' => HCU_array_key_exists(
'authcode', $mfaJson) ? strtolower($mfaJson[
'authcode']) :
null,
169 'authexpires' => HCU_array_key_exists(
'authexpires', $mfaJson) ? intval($mfaJson[
'authexpires']) :
null,
170 'mfadate' => HCU_array_key_exists(
'mfadate', $mfaJson) ? intval($mfaJson[
'mfadate']) : 0,
174 private function GetAccounts() {
176 $sql =
"SELECT DISTINCT ua.accountnumber 178 INNER JOIN {$cu}useraccounts ua on ua.user_id = u.user_id 179 WHERE u.user_name ilike '{$this->user_name}'";
181 $rs = db_query( $sql, $pHBEnv[
"dbh"] );
__get(string $propertyName)
__set(string $propertyName, string $value)
__construct(string $username, string $creditUnion, UserRepo $userRepo)
DecodeMFAJson(array $mfaJson)
__isset(String $propertyName)