<? 
Serval::call('tpl')->error = false;
if( isset($_POST['auth']) ){
	if( Serval::call('Auth')->Login() ){
		header("location: ".(isset($config['http_dir']) ? $config['http_dir'] : '/')."?login");
		die();
	}else{
		Serval::call('tpl')->error = Serval::call('Auth')->error;
	}
}
if(isset($_POST['lostpass'])){
	if( Serval::call('Auth')->renewpassword_link() ){
		header("location: ".(isset($config['http_dir']) ? $config['http_dir'] : '/')."?renew=ok");
		die();
	}else{
		Serval::call('tpl')->error = Serval::call('Auth')->error;
	}
}
if(isset($_GET['renew_key'])){
	if( Serval::call('Auth')->new_password($_GET['renew_key']) ){
		header("location: ".(isset($config['http_dir']) ? $config['http_dir'] : '/')."?renew=password");
		die();
	}
}

Serval::call('tpl')->header = false;
Serval::call('tpl')->footer = false;
Serval::call('tpl')->display("auth");
?>