  |
63 | 63 | | return false; |
| |
64 | 64 | | } |
| |
65 | 65 | | |
  |
| 66 | + | function savePassword($password) { |
| |
| 67 | + | global $osC_Database, $osC_Customer; |
| |
| 68 | + | |
| |
| 69 | + | $Qcustomer = $osC_Database->query('update :table_customers set customers_password = :customers_password where customers_id = :customers_id'); |
| |
| 70 | + | $Qcustomer->bindTable(':table_customers', TABLE_CUSTOMERS); |
| |
| 71 | + | $Qcustomer->bindValue(':customers_password', tep_encrypt_password($password)); |
| |
| 72 | + | $Qcustomer->bindInt(':customers_id', $osC_Customer->id); |
| |
| 73 | + | $Qcustomer->execute(); |
| |
| 74 | + | |
| |
| 75 | + | if ($Qcustomer->affectedRows() === 1) { |
| |
| 76 | + | $Qupdate = $osC_Database->query('update :table_customers_info set customers_info_date_account_last_modified = now() where customers_info_id = :customers_info_id'); |
| |
| 77 | + | $Qupdate->bindTable(':table_customers_info', TABLE_CUSTOMERS_INFO); |
| |
| 78 | + | $Qupdate->bindInt(':customers_info_id', $osC_Customer->id); |
| |
| 79 | + | $Qupdate->execute(); |
| |
| 80 | + | |
| |
| 81 | + | return true; |
| |
| 82 | + | } |
| |
| 83 | + | |
| |
| 84 | + | return false; |
| |
| 85 | + | } |
| |
| 86 | + | |
|
66 | 87 | | function checkEntry($email_address) { |
| |
67 | 88 | | global $osC_Database; |
| |
68 | 89 | | |
| |
|
|
 |
… |
|
78 | 99 | | return false; |
| |
79 | 100 | | } |
| |
80 | 101 | | |
  |
81 | | - | function checkPassword($email_address, $password) { |
| |
82 | | - | global $osC_Database; |
| |
| 102 | + | function checkPassword($password, $email_address = null) { |
| |
| 103 | + | global $osC_Database, $osC_Customer; |
|
83 | 104 | | |
  |
84 | | - | $Qcheck = $osC_Database->query('select customers_password from :table_customers where customers_email_address = :customers_email_address limit 1'); |
| |
85 | | - | $Qcheck->bindTable(':table_customers', TABLE_CUSTOMERS); |
| |
86 | | - | $Qcheck->bindValue(':customers_email_address', $email_address); |
| |
87 | | - | $Qcheck->execute(); |
| |
| 105 | + | if ($email_address === null) { |
| |
| 106 | + | $Qcheck = $osC_Database->query('select customers_password from :table_customers where customers_id = :customers_id'); |
| |
| 107 | + | $Qcheck->bindTable(':table_customers', TABLE_CUSTOMERS); |
| |
| 108 | + | $Qcheck->bindInt(':customers_id', $osC_Customer->id); |
| |
| 109 | + | $Qcheck->execute(); |
| |
| 110 | + | } else { |
| |
| 111 | + | $Qcheck = $osC_Database->query('select customers_password from :table_customers where customers_email_address = :customers_email_address limit 1'); |
| |
| 112 | + | $Qcheck->bindTable(':table_customers', TABLE_CUSTOMERS); |
| |
| 113 | + | $Qcheck->bindValue(':customers_email_address', $email_address); |
| |
| 114 | + | $Qcheck->execute(); |
| |
| 115 | + | } |
  |
88 | 116 | | |
| |
89 | 117 | | if ($Qcheck->numberOfRows() === 1) { |
| |
90 | 118 | | if ( (strlen($password) > 0) && (strlen($Qcheck->value('customers_password')) > 0) ) { |