<?php
require_once('newpass.php');
require_once('inc/security.php');
title("Passwort setzen");
$show = 'token';
if (isset($_REQUEST['token']))
{
$token = $_REQUEST['token'];
$uid = get_uid_for_token($token);
if ($uid != NULL && validate_uid_token($uid, $token))
{
$show = 'agb';
if (isset($_REQUEST['agb']) && $_REQUEST['agb'] == '1') {
$show = 'password';
}
if (isset($_POST['password']))
{
if ($_POST['password'] != $_POST['password2'])
input_error("Die beiden Passwort-Eingaben stimmen nicht überein.");
elseif ($_POST['password'] == '')
input_error("Es kann kein leeres Passwort gesetzt werden");
elseif (preg_match('/["\'\\\\]/', $_POST['password']) === 1)
input_error("Das Passwort enthält problematische Zeichen. Bitte keine Anführungszeichen und kein Backslash benutzen.");
elseif (($result = strong_password($_POST['password'])) !== true)
input_error("Das Passwort ist zu einfach (cracklib sagt: {$result})!");
else
{
require_once('session/checkuser.php');
require_once('inc/base.php');
logger(LOG_INFO, "modules/index/initialize_useraccount", "initialize", "uid »{$uid}« set a new password");
set_systemuser_password($uid, $_POST['password']);
invalidate_systemuser_token($uid);
$_SESSION['role'] = find_role($uid, '', True);;