diff --git a/en/register.php b/en/register.php index 6bec35c..09f1ea5 100644 --- a/en/register.php +++ b/en/register.php @@ -26,17 +26,6 @@ $str = str_replace("\r", '', $str); return $str; } - function getName() { - $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; - $randomString = ''; - - for ($i = 0; $i < 50; $i++) { - $index = rand(0, strlen($characters) - 1); - $randomString .= $characters[$index]; - } - return $randomString; - } - $password = getName(); $success = false; $username = $email = $ssh = $reason = @@ -96,7 +85,6 @@ ?>

Sign Up

See the wiki page on how to register.

- * Required field
">

Username: @@ -181,9 +169,10 @@ $message .= ".\nJoin reason:\n$reason\n\n\nTo accept this request, run this command as root:\n/root/bin/accept $username\nTo deny this request, run this command as root:\n/root/bin/deny $username\n"; $contents = "#!/usr/bin/env -S bash -e\n\n# This is the registration script for $username \n# This script was automatically generated by http://" . $_SERVER['HTTP_HOST'] . htmlspecialchars($_SERVER['PHP_SELF']). "\n\n"; - $contents .= '~/bin/mktuser ' . escapeshellarg($username) . ' ' . escapeshellarg($password) . " <<< " . escapeshellarg($_POST['ssh']) . "\n"; - $contents .= 'echo ' . escapeshellarg($password) . ' > /sshfs/home/' . $username . '/pass && chmod 600 /sshfs/home/' . $username . '/pass && ssh 192.168.122.30 chown ' . escapeshellarg($username . ':' . $username) . ' /sshfs/home/' . $username . '/pass' . "\n\n"; - if ($use_matrix) $contents .= '~/bin/mkmuser ' . escapeshellarg($username) . ' ' . escapeshellarg($password) . "\n"; + $contents .= 'password="$(tr -dc A-Za-z0-9