added signup

This commit is contained in:
jan6 2021-10-11 16:33:10 +03:00
parent d2ac193213
commit 4e01474f84
3 changed files with 33 additions and 1 deletions

1
dist/signup.php vendored Symbolic link
View File

@ -0,0 +1 @@
../signup.php

31
signup.php Normal file
View File

@ -0,0 +1,31 @@
<?php
include("/var/www/tilde.cafe/inc/header.html");
if($_POST==array()){
?>
<p>We'll contact you when your account is ready.<br/>
Don't want to use email? contact an admin directly.</p>
<form method="post">
<p>Username:</p>
<input type="text" name="username" required="required" maxlength="20" width="20ch" pattern="[a-z][-0-9a-z_]{2,}" placeholder="MyUserName"/><br/>
<p>E-mail:</p>
<input style="max-width:100%" type="email" name="email" required="required" minlength="7" maxlength="30" size="30" placeholder="email@example.com"/><br/>
<p>SSH <em>public</em> key (don't have one? check our <a href="https://tilde.cafe/wiki/ssh">wiki</a>):<p>
<!-- maximum length of 400 should allow even 4096-bit rsa keys, with a short comment, more than that is ridiculous -->
<input style="max-width:100%" type="text" name="sshkey" required="required" pattern="ssh-(rsa|(ed25519|ecdsa)(-sk)?) [0-9a-zA-Z+/=]{60,}( .*)?" size="100" placeholder="ssh-ed25519 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA MyUserName@home_pc"/><br/>
<p>Reason (why do you want/need an account?):</p><textarea cols="70" rows="2" name="reason" maxlength="140" required="required"></textarea><br/>
<input type="submit" value="Sign Up"/>
</form>
<?php
}else{
$username=$_POST["username"];$email=$_POST["email"];$reason=$_POST["reason"];$sshkey=$_POST["sshkey"];
$nl="\r\n";
$message="username: ".$username.$nl."email: ".$email.$nl."reason: ".$reason.$nl.$nl."makeuser ".$username." ".$email." \"".$sshkey."\"";
$sent=mail("jan6@tilde.cafe","new tilde.cafe signup",$message,"From: signup");
if($sent!=True){
print("error: signup failed to send!");
}else{
print("Signup sent! (signups are usually accepted within 48 hours)");
};
};
include("/var/www/tilde.cafe/inc/footer.html");
?>

@ -1 +1 @@
Subproject commit f9867010205118bdb9fc4d0bb0f4784e39081e35
Subproject commit 6d0cd753982d45255e872f9d69e0fab7cf3e1dee