Compare commits
1 Commits
79341b4c88
...
ffce2fc28b
| Author | SHA1 | Date | |
|---|---|---|---|
| ffce2fc28b |
@@ -22,7 +22,7 @@ require_once "../config.php";
|
||||
|
||||
// enforce admin via 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();
|
||||
}
|
||||
|
||||
@@ -53,10 +53,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
if (!isset($_POST["email"]) || !filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) {
|
||||
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");
|
||||
}
|
||||
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");
|
||||
}
|
||||
|
||||
@@ -74,17 +74,21 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
|
||||
if (!isset($res["verify_token"])) {
|
||||
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_url = $config["webroot"] . "/verify.php?t=" . $verify_token;
|
||||
require_once "../mail_templates.php";
|
||||
$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(
|
||||
($success ? RegisterState::PendingEmailVerify : RegisterState::PendingEmailSend), $verify_token);
|
||||
($success ? RegisterState::PendingEmailVerify : RegisterState::PendingEmailSend),
|
||||
$verify_token);
|
||||
|
||||
print("<title>Erfolgreich</title>");
|
||||
print("</head><body>");
|
||||
@@ -104,26 +108,26 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
}
|
||||
} else {
|
||||
$_SESSION["token"] = bin2hex(random_bytes(16));
|
||||
?>
|
||||
?>
|
||||
<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">
|
||||
<style>
|
||||
body{
|
||||
body{
|
||||
background-color: #525252;
|
||||
}
|
||||
.centered-form{
|
||||
}
|
||||
.centered-form{
|
||||
margin-top: 60px;
|
||||
}
|
||||
}
|
||||
|
||||
.centered-form .panel{
|
||||
.centered-form .panel{
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
box-shadow: rgba(0, 0, 0, 0.3) 20px 20px 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<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>
|
||||
</head>
|
||||
<body>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="row centered-form">
|
||||
<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"
|
||||
placeholder="Nutzername (für den Login)" pattern="[a-z1-9]{3,20}" required>
|
||||
</div>
|
||||
<?php if (isset($config["getPasswordOnRegistration"]) && $config["getPasswordOnRegistration"]) { ?>
|
||||
<?php if (isset($config["getPasswordOnRegistration"]) && $config["getPasswordOnRegistration"]) { ?>
|
||||
<div class="row">
|
||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||
<div class="form-group">
|
||||
@@ -173,7 +177,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<input type="hidden" name="token" id="token" value="<?php echo $_SESSION["token"]; ?>">
|
||||
<input type="submit" value="Registrieren" class="btn btn-info btn-block">
|
||||
|
||||
@@ -191,21 +195,21 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
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");
|
||||
}
|
||||
first_name.onkeyup = function (event) {
|
||||
first_name.onkeyup = function(event) {
|
||||
event.target.setCustomValidity("");
|
||||
}
|
||||
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");
|
||||
}
|
||||
last_name.onkeyup = function (event) {
|
||||
last_name.onkeyup = function(event) {
|
||||
event.target.setCustomValidity("");
|
||||
}
|
||||
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");
|
||||
}
|
||||
user_name.onkeyup = function (event) {
|
||||
@@ -214,8 +218,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
<?php if (isset($config["getPasswordOnRegistration"]) && $config["getPasswordOnRegistration"]) { ?>
|
||||
var password = document.getElementById("password")
|
||||
, confirm_password = document.getElementById("password_confirm");
|
||||
function validatePassword() {
|
||||
if (password.value != confirm_password.value) {
|
||||
function validatePassword(){
|
||||
if(password.value != confirm_password.value) {
|
||||
confirm_password.setCustomValidity("Passwörter stimmen nicht überein");
|
||||
} else {
|
||||
confirm_password.setCustomValidity('');
|
||||
@@ -224,7 +228,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
password.onchange = validatePassword;
|
||||
confirm_password.onkeyup = validatePassword;
|
||||
<?php } ?>
|
||||
</script>
|
||||
<?php } ?>
|
||||
</script>
|
||||
<?php } ?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -23,7 +23,7 @@ require_once "../mail_templates.php";
|
||||
|
||||
// enforce admin via 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();
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ try {
|
||||
. "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 />"
|
||||
. $note . "<br />"
|
||||
. "Zum Bearbeiten <a href=\"" . $adminUrl . "\">hier</a> klicken");
|
||||
. "Zum Bearbeiten <a href=\"". $adminUrl . "\">hier</a> klicken");
|
||||
$mxMsg->set_type("m.text");
|
||||
$response = $mxConn->send($config["register_room"], $mxMsg);
|
||||
|
||||
@@ -67,7 +67,8 @@ try {
|
||||
$message = $language["SEND_MATRIX_FAIL"];
|
||||
}
|
||||
$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);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ require_once "../mail_templates.php";
|
||||
|
||||
// enforce admin via 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();
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ try {
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
</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="panel panel-default">
|
||||
<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 class="panel-body">
|
||||
<form name="appForm" role="form" action="verify_admin.php" method="GET">
|
||||
@@ -168,7 +168,7 @@ try {
|
||||
|
||||
<?php
|
||||
} // else - no action provided
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
print("<title>" . $language["REGISTRATION_FAILED"] . "</title>");
|
||||
print("</head><body>");
|
||||
print("<h1>" . $language["REGISTRATION_FAILED"] . "</h1>");
|
||||
@@ -178,7 +178,7 @@ try {
|
||||
print("<p>" . $e->getMessage() . "</p>");
|
||||
}
|
||||
print("<a href=\"" . $config["webroot"] . "/index.php" . "\">Zur Registrierungsseite</a>");
|
||||
}
|
||||
?>
|
||||
< /body>
|
||||
</html>
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user