Compare commits
1 Commits
79341b4c88
...
ffce2fc28b
| Author | SHA1 | Date | |
|---|---|---|---|
| ffce2fc28b |
@@ -22,7 +22,7 @@ require_once "../config.php";
|
|||||||
|
|
||||||
// enforce admin via https
|
// enforce admin via https
|
||||||
if (!isset($_SERVER['HTTPS'])) {
|
if (!isset($_SERVER['HTTPS'])) {
|
||||||
header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], true, 301);
|
header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], true, 301);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,10 +53,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
if (!isset($_POST["email"]) || !filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) {
|
if (!isset($_POST["email"]) || !filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) {
|
||||||
throw new Exception("EMAIL_INVALID_FORMAT");
|
throw new Exception("EMAIL_INVALID_FORMAT");
|
||||||
}
|
}
|
||||||
if (isset($_POST["first_name"]) && !preg_match("/[A-Z][a-z]+/", $_POST["first_name"])) {
|
if (isset($_POST["first_name"]) && ! preg_match("/[A-Z][a-z]+/", $_POST["first_name"])) {
|
||||||
throw new Exception("FIRSTNAME_INVALID_FORMAT");
|
throw new Exception("FIRSTNAME_INVALID_FORMAT");
|
||||||
}
|
}
|
||||||
if (isset($_POST["last_name"]) && !preg_match("/[A-Z][a-z]+/", $_POST["last_name"])) {
|
if (isset($_POST["last_name"]) && ! preg_match("/[A-Z][a-z]+/", $_POST["last_name"])) {
|
||||||
throw new Exception("SIRNAME_INVALID_FORMAT");
|
throw new Exception("SIRNAME_INVALID_FORMAT");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,17 +74,21 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
|
|
||||||
if (!isset($res["verify_token"])) {
|
if (!isset($res["verify_token"])) {
|
||||||
error_log("sth. went wrong. registration did not throw but admin_token not set");
|
error_log("sth. went wrong. registration did not throw but admin_token not set");
|
||||||
throw Exception("Unknown Error");
|
throw Exception ("Unknown Error");
|
||||||
}
|
}
|
||||||
$verify_token = $res["verify_token"];
|
$verify_token = $res["verify_token"];
|
||||||
|
|
||||||
$verify_url = $config["webroot"] . "/verify.php?t=" . $verify_token;
|
$verify_url = $config["webroot"] . "/verify.php?t=" . $verify_token;
|
||||||
require_once "../mail_templates.php";
|
require_once "../mail_templates.php";
|
||||||
$success = send_mail_pending_verification(
|
$success = send_mail_pending_verification(
|
||||||
$config["homeserver"], $first_name . " " . $last_name, $email, $verify_url);
|
$config["homeserver"],
|
||||||
|
$first_name . " " . $last_name,
|
||||||
|
$email,
|
||||||
|
$verify_url);
|
||||||
|
|
||||||
$mx_db->setRegistrationStateVerify(
|
$mx_db->setRegistrationStateVerify(
|
||||||
($success ? RegisterState::PendingEmailVerify : RegisterState::PendingEmailSend), $verify_token);
|
($success ? RegisterState::PendingEmailVerify : RegisterState::PendingEmailSend),
|
||||||
|
$verify_token);
|
||||||
|
|
||||||
print("<title>Erfolgreich</title>");
|
print("<title>Erfolgreich</title>");
|
||||||
print("</head><body>");
|
print("</head><body>");
|
||||||
@@ -104,26 +108,26 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$_SESSION["token"] = bin2hex(random_bytes(16));
|
$_SESSION["token"] = bin2hex(random_bytes(16));
|
||||||
?>
|
?>
|
||||||
<title>Registriere dich für <?php echo $config["homeserver"]; ?></title>
|
<title>Registriere dich für <?php echo $config["homeserver"]; ?></title>
|
||||||
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet">
|
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<style>
|
<style>
|
||||||
body{
|
body{
|
||||||
background-color: #525252;
|
background-color: #525252;
|
||||||
}
|
}
|
||||||
.centered-form{
|
.centered-form{
|
||||||
margin-top: 60px;
|
margin-top: 60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.centered-form .panel{
|
.centered-form .panel{
|
||||||
background: rgba(255, 255, 255, 0.8);
|
background: rgba(255, 255, 255, 0.8);
|
||||||
box-shadow: rgba(0, 0, 0, 0.3) 20px 20px 20px;
|
box-shadow: rgba(0, 0, 0, 0.3) 20px 20px 20px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.1.min.js"></script>
|
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.1.min.js"></script>
|
||||||
<script type="text/javascript" src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
|
<script type="text/javascript" src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row centered-form">
|
<div class="row centered-form">
|
||||||
<div class="col-xs-12 col-sm-8 col-md-4 col-sm-offset-2 col-md-offset-4">
|
<div class="col-xs-12 col-sm-8 col-md-4 col-sm-offset-2 col-md-offset-4">
|
||||||
@@ -160,7 +164,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
<input type="text" name="username" id="username" class="form-control input-sm"
|
<input type="text" name="username" id="username" class="form-control input-sm"
|
||||||
placeholder="Nutzername (für den Login)" pattern="[a-z1-9]{3,20}" required>
|
placeholder="Nutzername (für den Login)" pattern="[a-z1-9]{3,20}" required>
|
||||||
</div>
|
</div>
|
||||||
<?php if (isset($config["getPasswordOnRegistration"]) && $config["getPasswordOnRegistration"]) { ?>
|
<?php if (isset($config["getPasswordOnRegistration"]) && $config["getPasswordOnRegistration"]) { ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -173,7 +177,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<input type="hidden" name="token" id="token" value="<?php echo $_SESSION["token"]; ?>">
|
<input type="hidden" name="token" id="token" value="<?php echo $_SESSION["token"]; ?>">
|
||||||
<input type="submit" value="Registrieren" class="btn btn-info btn-block">
|
<input type="submit" value="Registrieren" class="btn btn-info btn-block">
|
||||||
|
|
||||||
@@ -191,21 +195,21 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var first_name = document.getElementById("first_name");
|
var first_name = document.getElementById("first_name");
|
||||||
first_name.oninvalid = function (event) {
|
first_name.oninvalid = function(event) {
|
||||||
event.target.setCustomValidity("Vorname muss das Format <Großbuchstabe><Kleinbuchstaben> haben");
|
event.target.setCustomValidity("Vorname muss das Format <Großbuchstabe><Kleinbuchstaben> haben");
|
||||||
}
|
}
|
||||||
first_name.onkeyup = function (event) {
|
first_name.onkeyup = function(event) {
|
||||||
event.target.setCustomValidity("");
|
event.target.setCustomValidity("");
|
||||||
}
|
}
|
||||||
var last_name = document.getElementById("last_name");
|
var last_name = document.getElementById("last_name");
|
||||||
last_name.oninvalid = function (event) {
|
last_name.oninvalid = function(event) {
|
||||||
event.target.setCustomValidity("Nachname muss das Format <Großbuchstabe><Kleinbuchstaben> haben");
|
event.target.setCustomValidity("Nachname muss das Format <Großbuchstabe><Kleinbuchstaben> haben");
|
||||||
}
|
}
|
||||||
last_name.onkeyup = function (event) {
|
last_name.onkeyup = function(event) {
|
||||||
event.target.setCustomValidity("");
|
event.target.setCustomValidity("");
|
||||||
}
|
}
|
||||||
var user_name = document.getElementById("username");
|
var user_name = document.getElementById("username");
|
||||||
user_name.oninvalid = function (event) {
|
user_name.oninvalid = function(event) {
|
||||||
event.target.setCustomValidity("Nutzername darf zwischen 3 und 20 kleine Buchstaben und Zahlen enthalten");
|
event.target.setCustomValidity("Nutzername darf zwischen 3 und 20 kleine Buchstaben und Zahlen enthalten");
|
||||||
}
|
}
|
||||||
user_name.onkeyup = function (event) {
|
user_name.onkeyup = function (event) {
|
||||||
@@ -214,8 +218,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
<?php if (isset($config["getPasswordOnRegistration"]) && $config["getPasswordOnRegistration"]) { ?>
|
<?php if (isset($config["getPasswordOnRegistration"]) && $config["getPasswordOnRegistration"]) { ?>
|
||||||
var password = document.getElementById("password")
|
var password = document.getElementById("password")
|
||||||
, confirm_password = document.getElementById("password_confirm");
|
, confirm_password = document.getElementById("password_confirm");
|
||||||
function validatePassword() {
|
function validatePassword(){
|
||||||
if (password.value != confirm_password.value) {
|
if(password.value != confirm_password.value) {
|
||||||
confirm_password.setCustomValidity("Passwörter stimmen nicht überein");
|
confirm_password.setCustomValidity("Passwörter stimmen nicht überein");
|
||||||
} else {
|
} else {
|
||||||
confirm_password.setCustomValidity('');
|
confirm_password.setCustomValidity('');
|
||||||
@@ -224,7 +228,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
password.onchange = validatePassword;
|
password.onchange = validatePassword;
|
||||||
confirm_password.onkeyup = validatePassword;
|
confirm_password.onkeyup = validatePassword;
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</script>
|
</script>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ require_once "../mail_templates.php";
|
|||||||
|
|
||||||
// enforce admin via https
|
// enforce admin via https
|
||||||
if (!isset($_SERVER['HTTPS'])) {
|
if (!isset($_SERVER['HTTPS'])) {
|
||||||
header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], true, 301);
|
header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], true, 301);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ try {
|
|||||||
. "Zum Bearbeiten hier klicken:\r\n" . $adminUrl);
|
. "Zum Bearbeiten hier klicken:\r\n" . $adminUrl);
|
||||||
$mxMsg->set_formatted_body($first_name . ' ' . $last_name . " möchte sich registrieren und hat folgende Notiz hinterlassen:<br />"
|
$mxMsg->set_formatted_body($first_name . ' ' . $last_name . " möchte sich registrieren und hat folgende Notiz hinterlassen:<br />"
|
||||||
. $note . "<br />"
|
. $note . "<br />"
|
||||||
. "Zum Bearbeiten <a href=\"" . $adminUrl . "\">hier</a> klicken");
|
. "Zum Bearbeiten <a href=\"". $adminUrl . "\">hier</a> klicken");
|
||||||
$mxMsg->set_type("m.text");
|
$mxMsg->set_type("m.text");
|
||||||
$response = $mxConn->send($config["register_room"], $mxMsg);
|
$response = $mxConn->send($config["register_room"], $mxMsg);
|
||||||
|
|
||||||
@@ -67,7 +67,8 @@ try {
|
|||||||
$message = $language["SEND_MATRIX_FAIL"];
|
$message = $language["SEND_MATRIX_FAIL"];
|
||||||
}
|
}
|
||||||
$mx_db->setRegistrationStateVerify(
|
$mx_db->setRegistrationStateVerify(
|
||||||
($response ? RegisterState::PendingAdminVerify : RegisterState::PendingAdminSend), $token);
|
($response ? RegisterState::PendingAdminVerify : RegisterState::PendingAdminSend),
|
||||||
|
$token);
|
||||||
|
|
||||||
send_mail_pending_approval($config["homeserver"], $first_name . " " . $last_name, $email);
|
send_mail_pending_approval($config["homeserver"], $first_name . " " . $last_name, $email);
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ require_once "../mail_templates.php";
|
|||||||
|
|
||||||
// enforce admin via https
|
// enforce admin via https
|
||||||
if (!isset($_SERVER['HTTPS'])) {
|
if (!isset($_SERVER['HTTPS'])) {
|
||||||
header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], true, 301);
|
header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], true, 301);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.centered-form .panel{
|
.centered-form .panel{
|
||||||
background: rgba(255, 255, 255, 0.8);
|
background: rgba(255, 255, 255, 0.8);
|
||||||
box-shadow: rgba(0, 0, 0, 0.3) 20px 20px 20px;
|
box-shadow: rgba(0, 0, 0, 0.3) 20px 20px 20px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -127,7 +127,7 @@ try {
|
|||||||
<div class="col-xs-12 col-sm-8 col-md-4 col-sm-offset-2 col-md-offset-4">
|
<div class="col-xs-12 col-sm-8 col-md-4 col-sm-offset-2 col-md-offset-4">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title"><?php echo $language["ADMIN_VERIFY_SITE_TITLE"]; ?></h3>
|
<h3 class="panel-title"><?php echo $language["ADMIN_VERIFY_SITE_TITLE"] ; ?></h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<form name="appForm" role="form" action="verify_admin.php" method="GET">
|
<form name="appForm" role="form" action="verify_admin.php" method="GET">
|
||||||
@@ -168,7 +168,7 @@ try {
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
} // else - no action provided
|
} // else - no action provided
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
print("<title>" . $language["REGISTRATION_FAILED"] . "</title>");
|
print("<title>" . $language["REGISTRATION_FAILED"] . "</title>");
|
||||||
print("</head><body>");
|
print("</head><body>");
|
||||||
print("<h1>" . $language["REGISTRATION_FAILED"] . "</h1>");
|
print("<h1>" . $language["REGISTRATION_FAILED"] . "</h1>");
|
||||||
@@ -178,7 +178,7 @@ try {
|
|||||||
print("<p>" . $e->getMessage() . "</p>");
|
print("<p>" . $e->getMessage() . "</p>");
|
||||||
}
|
}
|
||||||
print("<a href=\"" . $config["webroot"] . "/index.php" . "\">Zur Registrierungsseite</a>");
|
print("<a href=\"" . $config["webroot"] . "/index.php" . "\">Zur Registrierungsseite</a>");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
< /body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user