forked from team/site
1
0
Fork 0

fixmailer

This commit is contained in:
Ben Harris 2018-04-24 15:06:18 -04:00
parent ead346e831
commit 2f9d5cccaa
5 changed files with 224 additions and 42 deletions

View File

@ -19,6 +19,8 @@
<link rel="stylesheet" href="/css/hacker.css">
<link rel="stylesheet" href="/css/font-awesome.css">
<?=$additional_head ?? ""?>
</head>
<body style="padding-top: 70px;">

2
signup/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
mg.key
/vendor/

5
signup/composer.json Normal file
View File

@ -0,0 +1,5 @@
{
"require": {
"swiftmailer/swiftmailer": "^6.0"
}
}

184
signup/composer.lock generated Normal file
View File

@ -0,0 +1,184 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "83b6abf6d841cdb5b1ce056b8fcfe973",
"packages": [
{
"name": "doctrine/lexer",
"version": "v1.0.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/lexer.git",
"reference": "83893c552fd2045dd78aef794c31e694c37c0b8c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c",
"reference": "83893c552fd2045dd78aef794c31e694c37c0b8c",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-0": {
"Doctrine\\Common\\Lexer\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"lexer",
"parser"
],
"time": "2014-09-09T13:34:57+00:00"
},
{
"name": "egulias/email-validator",
"version": "2.1.4",
"source": {
"type": "git",
"url": "https://github.com/egulias/EmailValidator.git",
"reference": "8790f594151ca6a2010c6218e09d96df67173ad3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/8790f594151ca6a2010c6218e09d96df67173ad3",
"reference": "8790f594151ca6a2010c6218e09d96df67173ad3",
"shasum": ""
},
"require": {
"doctrine/lexer": "^1.0.1",
"php": ">= 5.5"
},
"require-dev": {
"dominicsayers/isemail": "dev-master",
"phpunit/phpunit": "^4.8.35||^5.7||^6.0",
"satooshi/php-coveralls": "^1.0.1"
},
"suggest": {
"ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Egulias\\EmailValidator\\": "EmailValidator"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Eduardo Gulias Davis"
}
],
"description": "A library for validating emails against several RFCs",
"homepage": "https://github.com/egulias/EmailValidator",
"keywords": [
"email",
"emailvalidation",
"emailvalidator",
"validation",
"validator"
],
"time": "2018-04-10T10:11:19+00:00"
},
{
"name": "swiftmailer/swiftmailer",
"version": "v6.0.2",
"source": {
"type": "git",
"url": "https://github.com/swiftmailer/swiftmailer.git",
"reference": "412333372fb6c8ffb65496a2bbd7321af75733fc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/412333372fb6c8ffb65496a2bbd7321af75733fc",
"reference": "412333372fb6c8ffb65496a2bbd7321af75733fc",
"shasum": ""
},
"require": {
"egulias/email-validator": "~2.0",
"php": ">=7.0.0"
},
"require-dev": {
"mockery/mockery": "~0.9.1",
"symfony/phpunit-bridge": "~3.3@dev"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "6.0-dev"
}
},
"autoload": {
"files": [
"lib/swift_required.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Chris Corbyn"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Swiftmailer, free feature-rich PHP mailer",
"homepage": "http://swiftmailer.symfony.com",
"keywords": [
"email",
"mail",
"mailer"
],
"time": "2017-09-30T22:39:41+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}

View File

@ -1,26 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="tilde.team unix group">
<meta name="author" content="Ben Harris">
<title>signup~tilde.team</title>
<?php
require 'vendor/autoload.php';
<link rel="manifest" href="/manifest.json">
<meta name="theme-color" content="#00cc00">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-310x310.png">
<link rel="icon" type="image/png" sizes="192x192" href="/apple-touch-icon-precomposed.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
$pw = file_get_contents("mg.key");
<script src="/js/vue.min.js"></script>
<link rel="stylesheet" href="https://tilde.team/css/hacker.css">
$transport = (new Swift_SmtpTransport('smtp.mailgun.org', 465, 'ssl'))
->setUsername('postmaster@mg.tilde.team')
->setPassword($pw);
$mailer = new Swift_Mailer($transport);
$additional_head = '<script src="/js/vue.min.js"></script>';
include __DIR__.'/../header.php';
?>
</head>
<body>
<div class="container" id="app">
<h1>
tilde.team signup
@ -66,29 +58,28 @@
}
if ($message == "") {
$headers = "From: {$_REQUEST["username"]} <{$_REQUEST["email"]}>\n";
$headers .= "Sender: www-data@tilde.team\n";
$headers .= "To: admin@tilde.team\n";
$headers .= "Reply-To: {$_REQUEST["email"]}\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$forwardmail = $_REQUEST["forward_email"] == "on" ? '<a href="https://domains.google.com/registrar#z=e&d=3471834,tilde.team&chp=z,d">yes</a>' : "no";
$forwardmail = $_REQUEST["forward_email"] == "on"
? '<a href="https://domains.google.com/registrar#z=e&d=3471834,tilde.team&chp=z,d">yes</a>' : "no";
$msgbody = "<h1>New tilde.team signup</h1>
$msgbody = "<h1>tilde.team signup</h1>
<hr>
Desired username: <strong>{$_REQUEST["username"]}</strong><br>
Contact email: <strong><a href=\"mailto:{$_REQUEST["email"]}\">{$_REQUEST["email"]}</a></strong><br>
Reason: <strong>{$_REQUEST["interest"]}</strong><br>
Forward mail?: <strong>$forwardmail</strong><br>
SSH Key: <pre>{$_REQUEST["sshkey"]}</pre>";
desired username: <strong>{$_REQUEST["username"]}</strong><br>
contact email: <strong><a href=\"mailto:{$_REQUEST["email"]}\">{$_REQUEST["email"]}</a></strong><br>
reason: <strong>{$_REQUEST["interest"]}</strong><br>
forward mail?: <strong>$forwardmail</strong><br>
ssh key: <pre>{$_REQUEST["sshkey"]}</pre>";
if (mail('bharrismac@gmail.com', 'tilde.team signup', $msgbody, $headers)) {
echo '<div class="alert alert-success" role="alert">
email sent! i\'ll get back to you soon with login instructions! <a href="/">back to tilde.team home</a>
</div>';
} else {
echo 'The email has failed! Send me a message manually at <a href="mailto:ben@tilde.team">ben@tilde.team</a>';
}
$message = (new Swift_Message('tilde.team signup'))
->setFrom(['sys@tilde.team' => 'tilde'])
->setTo(['admin@tilde.team'])
->setReplyTo([$_REQUEST["email"]])
->setBody($msgbody, 'text/html');
$result = $mailer->send($message);
echo '<div class="alert alert-success" role="alert">
email sent! i\'ll get back to you soon with login instructions! <a href="/">back to tilde.team home</a>
</div>';
} else {
?>
<div class="alert alert-warning" role="alert">
@ -142,7 +133,5 @@
})
</script>
</body>
</html>
<?php include __DIR__.'/../footer.php';