//JOS KAIKKI OK-> $_SESSION['id'] = $login_user->id; $_SESSION['yritys_id'] = $login_user->yritys_id; $_SESSION['email'] = $login_user->sahkoposti; addDynamicAddress(); if ($login_user->vahvista_eula) { header("Location:eula.php"); exit; } // else ... header("Location:tuotehaku.php"); exit; } } else { //Ei tuloksia == väärä käyttäjätunnus --> lähetä takaisin header("Location:index.php?redir=1"); exit; // Sähköpostia ei löytynyt } } elseif ($mode == "password_reset") { $sql_query = "\tSELECT\tid, sahkoposti, aktiivinen, demo, voimassaolopvm\n\t\t\t\t\tFROM\tkayttaja\n\t\t\t\t\tWHERE\tsahkoposti = ?"; $login_user = $db->query($sql_query, [$email], NULL, PDO::FETCH_OBJ); if ($login_user) { beginning_user_checks($login_user, NULL, TRUE); password_reset($db, $login_user, 'reset'); } else { header("Location:index.php?redir=1"); //Sähköpostia ei löytynyt exit; } }
//print $result; } break; case "logout": user_logout(); header("Location: /"); break; case "login": if (user_login()) { header("Location: /" . $_SESSION["user_name"]); } else { header("Location: /login/failure"); } break; case "password_reset": $result = password_reset(); if ($result > 0) { header("Location: /password_reset/success/" . $result); } else { header("Location: /password_reset/failure/" . $result); } break; default: header("Location: /404"); break; } break; // user // user case "account": require_once "lib/api/users.php";
$confirm = $_POST['confirm']; $uid = uid_from_email($email); if (empty($email) || empty($password)) { $error = __('Missing a required field.'); } elseif ($password != $confirm) { $error = __('Password fields do not match.'); } elseif (!good_passwd($password)) { $length_min = config_get_int('options', 'passwd_min_len'); $error = __("Your password must be at least %s characters.", $length_min); } elseif ($uid == null) { $error = __('Invalid e-mail.'); } if (empty($error)) { $salt = generate_salt(); $hash = salted_hash($password, $salt); $error = password_reset($hash, $salt, $resetkey, $email); } } elseif (isset($_POST['email'])) { $email = $_POST['email']; $username = username_from_id(uid_from_email($email)); if (empty($email)) { $error = __('Missing a required field.'); } else { send_resetkey($email); header('Location: ' . get_uri('/passreset/') . '?step=confirm'); exit; } } $step = isset($_GET['step']) ? $_GET['step'] : NULL; html_header(__("Password Reset")); ?>