function build_change_forget_password_form($email_or_username, $type) { $helper_obj = new Helper(); $db_functions_obj = new DbFunctions(); $output = "<div class='change-pw-div'>"; $output .= "<div class='reg-fields-title'>" . $helper_obj->t("Change Password") . "</div>"; $output .= "<div style='margin:auto;width:37%'>"; $output .= "<form name='change_forget_password' id='change_forget_password' method='post'>"; $output .= "<input plaseholder='" . $helper_obj->t("Password") . "' class='form-item-input' type='password' name='password_forget' id='password_forget'>"; $output .= "<div class='reg-item'>\n <input type='checkbox' onclick='showPassword(\"_forget\");'>\n <div class='show-password-text'>" . $helper_obj->t("Show My Password") . " </div>\n </div>"; $output .= "<input class='submit' style='margin-right: 15px;width: 245px;' type='submit' value='" . $helper_obj->t("Change") . "'>"; $output .= "</form>"; $output .= "</div>"; $output .= "</div>"; if (isset($_POST['password_forget']) && trim($_POST['password_forget']) != '') { $valid = $db_functions_obj->change_password($email_or_username, $type, $_POST['password_forget']); if ($valid) { $helper_obj->set_message($helper_obj->t("Password has been changed successfully"), 'success'); } else { $helper_obj->set_message($helper_obj->t("Error while changing password"), 'error'); } } return $output; }
function change_password($email, $old_password, $new_password) { $db_fuctions_obj = new DbFunctions(); return $db_fuctions_obj->change_password($email, $old_password, $new_password); }