Send some emails
This commit is contained in:
1 parent
e41c6de844
commit
14a3513237
7 files changed
+78
-18
No files matched your search
@@ -67,15 +67,18 @@ if( isset($_POST['submit']) ) {
|
||||
$newsletter_checked = isset($_POST['newsletter']) ? " checked" : "";
|
||||
}
|
||||
if($data !== NULL) {
|
||||
// persist
|
||||
try {
|
||||
// persist
|
||||
save_activation_form($data);
|
||||
|
||||
// Push the user to LDAP
|
||||
$migrated = ldap_add_user($data['username'], $data['firstname'], $data['lastname'], $data['email'], $data['password'], array('dns-alle'));
|
||||
_log($migrated);
|
||||
// FIXME assumes this works every time
|
||||
set_migrated($data['userid']);
|
||||
set_migrated($data['userid']); // FIXME assumes this works every time
|
||||
|
||||
// send warm and fuzzy welcome email
|
||||
send_confirmation_email($data, $user);
|
||||
|
||||
// redirect to confirmation page
|
||||
redirect("/snapporder/activate_confirmed.php");
|
||||
die();
|
||||
|
||||
@@ -10,8 +10,9 @@
|
||||
* "firstname": "Jon",
|
||||
* "lastname": "Hansen",
|
||||
* "email": "jon@uio.no",
|
||||
* "purchased": "2004-02-12" // optional, format: ISO-8601 date
|
||||
* "source": "snapporder_sms" // optional, possible values: "snapporder" or "snapporder_sms"
|
||||
* "purchased": "2004-02-12" // optional, format: ISO-8601 date
|
||||
* "source": "snapporder_sms" // optional, possible values: "snapporder" or "snapporder_sms"
|
||||
* "membership_trial": "buddy" // optional, gives free membership in autumn, possible value: "buddy"
|
||||
* }
|
||||
*
|
||||
* Response:
|
||||
@@ -26,6 +27,7 @@
|
||||
* "email": "jon@uio.no",
|
||||
* "birthdate": "1985-03-01",
|
||||
* "registration_status": "partial" // "partial" means show link
|
||||
* "membership_trial": "buddy" // possible value: "buddy", user has a trial membership, unset if not
|
||||
* "registration_url": "/snapporder/register_partial.php?userid=4331&token=lol"
|
||||
* }
|
||||
*
|
||||
@@ -39,7 +41,6 @@
|
||||
* "source": "snapporder_sms" // optional, possible values: "snapporder" or "snapporder_sms"
|
||||
* }
|
||||
*
|
||||
* TODO maybe check $_SERVER['REQUEST_METHOD']
|
||||
*/
|
||||
|
||||
/* Pull in Inside */
|
||||
@@ -226,6 +227,11 @@ if( isset($data['membership_trial']) ) {
|
||||
$user['membership_trial'] = $data['membership_trial'];
|
||||
}
|
||||
|
||||
/* Send welcome email */
|
||||
if($reg_type === "new") {
|
||||
send_activation_email($data, $user);
|
||||
}
|
||||
|
||||
/* Return encrypted user object */
|
||||
echo $crypt->json_encode_and_encrypt($user);
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
/*! normalize.css v3.0.1 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;}body{margin:0;}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block;}audio,canvas,progress,video{display:inline-block;vertical-align:baseline;}audio:not([controls]){display:none;height:0;}[hidden],template{display:none;}a{background:transparent;}a:active,a:hover{outline:0;}abbr[title]{border-bottom:1px dotted;}b,strong{font-weight:bold;}dfn{font-style:italic;}h1{font-size:2em;margin:0.67em 0;}mark{background:#ff0;color:#000;}small{font-size:80%;}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}sup{top:-0.5em;}sub{bottom:-0.25em;}img{border:0;}svg:not(:root){overflow:hidden;}figure{margin:1em 40px;}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0;}pre{overflow:auto;}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em;}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0;}button{overflow:visible;}button,select{text-transform:none;}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;}button[disabled],html input[disabled]{cursor:default;}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}input{line-height:normal;}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto;}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none;}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em;}legend{border:0;padding:0;}textarea{overflow:auto;}optgroup{font-weight:bold;}table{border-collapse:collapse;border-spacing:0;}td,th{padding:0;}meta.foundation-version{font-family:"/5.2.3/";}meta.foundation-mq-small{font-family:"/only screen/";width:0em;}meta.foundation-mq-medium{font-family:"/only screen and (min-width:40.063em)/";width:40.063em;}meta.foundation-mq-large{font-family:"/only screen and (min-width:64.063em)/";width:64.063em;}meta.foundation-mq-xlarge{font-family:"/only screen and (min-width:90.063em)/";width:90.063em;}meta.foundation-mq-xxlarge{font-family:"/only screen and (min-width:120.063em)/";width:120.063em;}meta.foundation-data-attribute-namespace{font-family:false;}html,body{height:100%;}*,*:before,*:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}html,body{font-size:100%;}body{background:#fff;color:#222;padding:0;margin:0;font-family:"Helvetica Neue","Helvetica",Helvetica,Arial,sans-serif;font-weight:normal;font-style:normal;line-height:1;position:relative;cursor:default;}a:hover{cursor:pointer;}img{max-width:100%;height:auto;}img{-ms-interpolation-mode:bicubic;}#map_canvas img,#map_canvas embed,#map_canvas object,.map_canvas img,.map_canvas embed,.map_canvas object{max-width:none !important;}.left{float:left !important;}.right{float:right !important;}.clearfix:before,.clearfix:after{content:" ";display:table;}.clearfix:after{clear:both;}.hide{display:none;}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;}img{display:inline-block;vertical-align:middle;}textarea{height:auto;min-height:50px;}select{width:100%;}.row{width:100%;margin-left:auto;margin-right:auto;margin-top:0;margin-bottom:0;max-width:62.5rem;}.row:before,.row:after{content:" ";display:table;}.row:after{clear:both;}.row.collapse>.column,.row.collapse>.columns{padding-left:0;padding-right:0;}.row.collapse .row{margin-left:0;margin-right:0;}.row .row{width:auto;margin-left:-0.9375rem;margin-right:-0.9375rem;margin-top:0;margin-bottom:0;max-width:none;}.row .row:before,.row .row:after{content:" ";display:table;}.row .row:after{clear:both;}.row .row.collapse{width:auto;margin:0;max-width:none;}.row .row.collapse:before,.row .row.collapse:after{content:" ";display:table;}.row .row.collapse:after{clear:both;}.column,.columns{padding-left:0.9375rem;padding-right:0.9375rem;width:100%;float:left;}@media only screen{.small-push-0{position:relative;left:0%;right:auto;}.small-pull-0{position:relative;right:0%;left:auto;}.small-push-1{position:relative;left:8.3333333333%;right:auto;}.small-pull-1{position:relative;right:8.3333333333%;left:auto;}.small-push-2{position:relative;left:16.6666666667%;right:auto;}.small-pull-2{position:relative;right:16.6666666667%;left:auto;}.small-push-3{position:relative;left:25%;right:auto;}.small-pull-3{position:relative;right:25%;left:auto;}.small-push-4{position:relative;left:33.3333333333%;right:auto;}.small-pull-4{position:relative;right:33.3333333333%;left:auto;}.small-push-5{position:relative;left:41.6666666667%;right:auto;}.small-pull-5{position:relative;right:41.66Line truncated
|
||||
/*! normalize.css v3.0.1 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;}body{margin:0;}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block;}audio,canvas,progress,video{display:inline-block;vertical-align:baseline;}audio:not([controls]){display:none;height:0;}[hidden],template{display:none;}a{background:transparent;}a:active,a:hover{outline:0;}abbr[title]{border-bottom:1px dotted;}b,strong{font-weight:bold;}dfn{font-style:italic;}h1{font-size:2em;margin:0.67em 0;}mark{background:#ff0;color:#000;}small{font-size:80%;}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}sup{top:-0.5em;}sub{bottom:-0.25em;}img{border:0;}svg:not(:root){overflow:hidden;}figure{margin:1em 40px;}hr{-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;height:0;}pre{overflow:auto;}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em;}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0;}button{overflow:visible;}button,select{text-transform:none;}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;}button[disabled],html input[disabled]{cursor:default;}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}input{line-height:normal;}input[type="checkbox"],input[type="radio"]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0;}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto;}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none;}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em;}legend{border:0;padding:0;}textarea{overflow:auto;}optgroup{font-weight:bold;}table{border-collapse:collapse;border-spacing:0;}td,th{padding:0;}meta.foundation-version{font-family:"/5.2.3/";}meta.foundation-mq-small{font-family:"/only screen/";width:0em;}meta.foundation-mq-medium{font-family:"/only screen and (min-width:40.063em)/";width:40.063em;}meta.foundation-mq-large{font-family:"/only screen and (min-width:64.063em)/";width:64.063em;}meta.foundation-mq-xlarge{font-family:"/only screen and (min-width:90.063em)/";width:90.063em;}meta.foundation-mq-xxlarge{font-family:"/only screen and (min-width:120.063em)/";width:120.063em;}meta.foundation-data-attribute-namespace{font-family:false;}html,body{height:100%;}*,*:before,*:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}html,body{font-size:100%;}body{background:#fff;color:#222;padding:0;margin:0;font-family:"Helvetica Neue","Helvetica",Helvetica,Arial,sans-serif;font-weight:normal;font-style:normal;line-height:1;position:relative;cursor:default;}a:hover{cursor:pointer;}img{max-width:100%;height:auto;}img{-ms-interpolation-mode:bicubic;}#map_canvas img,#map_canvas embed,#map_canvas object,.map_canvas img,.map_canvas embed,.map_canvas object{max-width:none !important;}.left{float:left !important;}.right{float:right !important;}.clearfix:before,.clearfix:after{content:" ";display:table;}.clearfix:after{clear:both;}.hide{display:none;}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;}img{display:inline-block;vertical-align:middle;}textarea{height:auto;min-height:50px;}select{width:100%;}.row{width:100%;margin-left:auto;margin-right:auto;margin-top:0;margin-bottom:0;max-width:62.5rem;}.row:before,.row:after{content:" ";display:table;}.row:after{clear:both;}.row.collapse>.column,.row.collapse>.columns{padding-left:0;padding-right:0;}.row.collapse .row{margin-left:0;margin-right:0;}.row .row{width:auto;margin-left:-0.9375rem;margin-right:-0.9375rem;margin-top:0;margin-bottom:0;max-width:none;}.row .row:before,.row .row:after{content:" ";display:table;}.row .row:after{clear:both;}.row .row.collapse{width:auto;margin:0;max-width:none;}.row .row.collapse:before,.row .row.collapse:after{content:" ";display:table;}.row .row.collapse:after{clear:both;}.column,.columns{padding-left:0.9375rem;padding-right:0.9375rem;width:100%;float:left;}@media only screen{.small-push-0{position:relative;left:0%;right:auto;}.small-pull-0{position:relative;right:0%;left:auto;}.small-push-1{position:relative;left:8.3333333333%;right:auto;}.small-pull-1{position:relative;right:8.3333333333%;left:auto;}.small-push-2{position:relative;left:16.6666666667%;right:auto;}.small-pull-2{position:relative;right:16.6666666667%;left:auto;}.small-push-3{position:relative;left:25%;right:auto;}.small-pull-3{position:relative;right:25%;left:auto;}.small-push-4{position:relative;left:33.3333333333%;right:auto;}.small-pull-4{position:relative;right:33.3333333333%;left:auto;}.small-push-5{positLine truncated
|
||||
@@ -533,5 +533,59 @@ function save_activation_form($data) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* The purpose of this email is:
|
||||
* - to store the registration_url in the users inbox
|
||||
* - give some sort of positive confirmation outside of the SnappOrder-app
|
||||
*/
|
||||
function send_activation_email($data, $user) {
|
||||
$from_email = "medlemskap@studentersamfundet.no";
|
||||
$sendto = $user['email'];
|
||||
$subject = "Aktiver medlemskapet ditt - Det Norske Studentersamfund";
|
||||
|
||||
$headers = "From: $from_email\r\n";
|
||||
$headers .= "Reply-To: $from_email\r\n";
|
||||
$headers .= "MIME-Version: 1.0\r\n";
|
||||
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
|
||||
|
||||
$message = '<html><body>';
|
||||
$message .= '<h3>Hei '.$user['firstname'].', og velkommen til Det Norske Studentersamfund!</h3>';
|
||||
$message .= '<p>For at medlemskapet ditt skal være gyldig trenger vi noen flere opplysninger fra deg.</p>';
|
||||
$message .= '<p style="margin-bottom: 20px;">Trykk på lenken under for å fortsette.</p>';
|
||||
$message .= '<p style="margin-bottom: 20px;"><a href="'.$user['registration_url'].'" style="font-family: Arial,sans-serif; color: white; font-weight: bold; font-size: 20px; padding: 0.8em 1.2em; border: none; text-decoration: none; background-color: #58AA58; display: inline-block; text-align: center; margin: 0;">Aktiver medlemskapet</a></p>';
|
||||
$message .= "<p>Med vennlig hilsen<br>Det Norske Studentersamfund</p>";
|
||||
$message .= "</body></html>";
|
||||
|
||||
@mail($sendto, $subject, $message, $headers);
|
||||
}
|
||||
|
||||
/* The purpose of this email is:
|
||||
* - to store the users username in the users inbox
|
||||
* - give some sort of positive confirmation that everything is as it should be!
|
||||
*/
|
||||
function send_confirmation_email($data, $user) {
|
||||
$from_email = "medlemskap@studentersamfundet.no";
|
||||
$sendto = $user['email'];
|
||||
$subject = "Medlemskap aktivert - Det Norske Studentersamfund";
|
||||
|
||||
$headers = "From: $from_email\r\n";
|
||||
$headers .= "Reply-To: $from_email\r\n";
|
||||
$headers .= "MIME-Version: 1.0\r\n";
|
||||
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
|
||||
|
||||
$inside_url = "https://inside.studentersamfundet.no/";
|
||||
$password_reset_url = "https://brukerinfo.neuf.no/accounts/password/reset";
|
||||
|
||||
$message = '<html><body>';
|
||||
$message .= '<h3>Gratulerer med ditt nye medlemskap i Det Norske Studentersamfund!</h3>';
|
||||
$message .= '<p>Brukernavnet ditt er: '.$data['username'].'</p>';
|
||||
$message .= '<p>Om du i fremtiden skulle glemme passordet ditt, så kan du <a href="'.$password_reset_url.'">få nytt her</a>.</p>';
|
||||
$message .= '<p style="margin-bottom: 20px;">Trykk på lenken under for å logge inn og se medlemskapet ditt.</p>';
|
||||
$message .= '<p style="margin-bottom: 20px;"><a href="'.$inside_url.'" style="font-family: Arial,sans-serif; color: white; font-weight: bold; font-size: 20px; padding: 0.8em 1.2em; border: none; text-decoration: none; background-color: #58AA58; display: inline-block; text-align: center; margin: 0;">Logg inn</a></p>';
|
||||
$message .= "<p>Med vennlig hilsen<br>Det Norske Studentersamfund</p>";
|
||||
$message .= "</body></html>";
|
||||
|
||||
@mail($sendto, $subject, $message, $headers);
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -193,16 +193,13 @@ body {
|
||||
.btn-submit,
|
||||
.button {
|
||||
font-family: Arial, sans-serif;
|
||||
color: darken($green, 30%);
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
padding: 0.8em 1.2em;
|
||||
border: none;
|
||||
background: $green url('../img/gradient.png') repeat-x bottom left;
|
||||
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
|
||||
border: 1px solid darken($green, 10%);
|
||||
background-color: $green;
|
||||
display: inline-block;
|
||||
box-shadow: 0 1px 0 rgba(17, 73, 17, 0.1), 0 1px 0 lighten($green, 10%) inset;
|
||||
text-align: center;
|
||||
border-radius: 6px;
|
||||
margin: 0;
|
||||
@@ -210,7 +207,6 @@ body {
|
||||
&:hover,
|
||||
&:focus {
|
||||
background-color: lighten($green, 10%);
|
||||
color: darken($green, 20%);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ function test_post_register() {
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=UTF-8'));
|
||||
|
||||
$result = curl_exec($ch);
|
||||
var_dump($result);
|
||||
$result = $crypt->decrypt(trim($result));
|
||||
$decoded_result = (array) json_decode($result);
|
||||
|
||||
@@ -133,8 +134,8 @@ function test_post_register_buddy_renewal() {
|
||||
/* Register */
|
||||
curl_close ($ch);
|
||||
}
|
||||
test_get_query();
|
||||
//test_post_register();
|
||||
//test_get_query();
|
||||
test_post_register();
|
||||
//test_post_register_renewal();
|
||||
//test_post_register_buddy();
|
||||
//test_post_register_buddy_renewal();
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"firstname": "Üve",
|
||||
"firstname": "Üve Nikolai",
|
||||
"lastname": "Bårdvigsen Røed",
|
||||
"email": "abaab236zzazbasdfbfffaaaaaba@aaa44za.com",
|
||||
"phone": "+4749089787"
|
||||
"email": "nikolaik+test3@gmail.com",
|
||||
"phone": "+4749379787"
|
||||
}
|
||||
Reference in new issue
Block a user