mirror of https://github.com/ThunixdotNet/www.git
Update includes/signup.php
This commit is contained in:
parent
0138a6e12d
commit
31dfa8fc34
|
@ -37,23 +37,24 @@ if ( $tv == "tildeverse" )
|
|||
// Success!
|
||||
$success = 'success2';
|
||||
|
||||
// Check if username already taken
|
||||
exec("id $username 2>&1", $null, $retval);
|
||||
if($retval == 0)
|
||||
// Check if username already taken
|
||||
if (posix_getpwnam($username)) {
|
||||
$success = 'success3';
|
||||
}
|
||||
|
||||
// Check SSH public key format:
|
||||
exec("echo $pubkey | ssh-keygen -l -f - 2>&1", $null, $retval);
|
||||
if($retval != 0)
|
||||
// Simple SSH public key format check
|
||||
$valid_key_starts = ['ssh-rsa', 'ssh-dss', 'ecdsa-sha2', 'ssh-ed25519'];
|
||||
$key_parts = explode(' ', $pubkey, 3);
|
||||
if (!in_array($key_parts[0], $valid_key_starts) || count($key_parts) < 2) {
|
||||
$success = 'success4';
|
||||
}
|
||||
|
||||
if ( $success == "success2" )
|
||||
{
|
||||
if ($success == "success2") {
|
||||
mail($destination_addr, $subject, $mailbody, $from);
|
||||
$fp = fopen($user_queue, 'a');
|
||||
fwrite($fp, "'$username','$email','$pubkey'\n");
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
header("Location: $site_root/?page=$success");
|
||||
|
|
Loading…
Reference in New Issue