public static function execute(ApplicationAbstract $application) { $OSCOM_PDO = Registry::get('PDO'); $OSCOM_MessageStack = Registry::get('MessageStack'); $Qcheck = $OSCOM_PDO->prepare('select customers_id, customers_firstname, customers_lastname, customers_gender, customers_email_address, customers_password from :table_customers where customers_email_address = :customers_email_address limit 1'); $Qcheck->bindValue(':customers_email_address', $_POST['email_address']); $Qcheck->execute(); if ($Qcheck->fetch() !== false) { $password = Hash::getRandomString(ACCOUNT_PASSWORD); if (Account::savePassword($password, $Qcheck->valueInt('customers_id'))) { if (ACCOUNT_GENDER > -1) { if ($Qcheck->value('customers_gender') == 'm') { $email_text = sprintf(OSCOM::getDef('email_addressing_gender_male'), $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } else { $email_text = sprintf(OSCOM::getDef('email_addressing_gender_female'), $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } } else { $email_text = sprintf(OSCOM::getDef('email_addressing_gender_unknown'), $Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } $email_text .= sprintf(OSCOM::getDef('email_password_reminder_body'), OSCOM::getIPAddress(), STORE_NAME, $password, STORE_OWNER_EMAIL_ADDRESS); $pEmail = new Mail($Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname'), $Qcheck->valueProtected('customers_email_address'), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, sprintf(OSCOM::getDef('email_password_reminder_subject'), STORE_NAME)); $pEmail->setBodyPlain($email_text); $pEmail->send(); $OSCOM_MessageStack->add('LogIn', OSCOM::getDef('success_password_forgotten_sent'), 'success'); } OSCOM::redirect(OSCOM::getLink(null, null, 'LogIn', 'SSL')); } else { $OSCOM_MessageStack->add('PasswordForgotten', OSCOM::getDef('error_password_forgotten_no_email_address_found')); } }
public static function execute($data) { if (!empty($data['password'])) { $data['password'] = Hash::get(trim($data['password'])); } return OSCOM::callDB('Admin\\Administrators\\Save', $data); }
public static function execute($data) { $result = OSCOM::callDB('Admin\\Login\\GetAdmin', array('username' => $data['username'])); if (!empty($result)) { return Hash::validate($data['password'], $result['user_password']); } return false; }
public function generateCartID($length = 5) { return Hash::getRandomString($length, 'digits'); }
/** * Checks if a password matches the current or provided customer account * * @param string $password The unencrypted password to confirm * @param string $email_address The email address of the customer account to check against * @access public * @return boolean */ public static function checkPassword($password, $email_address = null) { $OSCOM_PDO = Registry::get('PDO'); $OSCOM_Customer = Registry::get('Customer'); if (empty($email_address)) { $Qcheck = $OSCOM_PDO->prepare('select customers_password from :table_customers where customers_id = :customers_id'); $Qcheck->bindInt(':customers_id', $OSCOM_Customer->getID()); $Qcheck->execute(); } else { $Qcheck = $OSCOM_PDO->prepare('select customers_password from :table_customers where customers_email_address = :customers_email_address limit 1'); $Qcheck->bindValue(':customers_email_address', $email_address); $Qcheck->execute(); } $result = $Qcheck->fetch(); if ($result !== false) { return Hash::validate($password, $Qcheck->value('customers_password')); } return false; }