aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/sledjchisl
diff options
context:
space:
mode:
Diffstat (limited to 'src/sledjchisl')
-rw-r--r--src/sledjchisl/sledjchisl.c78
1 files changed, 75 insertions, 3 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c
index c4a1ae4..87aac15 100644
--- a/src/sledjchisl/sledjchisl.c
+++ b/src/sledjchisl/sledjchisl.c
@@ -3082,8 +3082,15 @@ char *checkLinky(reqData *Rd)
3082 { 3082 {
3083 char *t1 = qurl_encode(t0, strlen(t0)); 3083 char *t1 = qurl_encode(t0, strlen(t0));
3084 free(ret); 3084 free(ret);
3085 ret = xmprintf("<p><font color='red'><b>You have an email waiting with a linky in it <a href='https://%s%s?hashish=%s'>%s</a>.</b></font></p>\n", 3085 ret = xmprintf("<p><font color='red'><b>You have an email waiting with a validation link in it, please check your email. &nbsp; "
3086 Rd->Host, Rd->RUri, t1, t0); 3086 "It will be from %s@%s, and it might be in your spam folder, coz these sorts of emails sometimes end up there. &nbsp; "
3087 "You should add that email address to your contacts, or otherwise let it through your spam filter. &nbsp; "
3088// "<a href='https://%s%s?hashish=%s'>%s</a>"
3089 "</b></font></p>\n",
3090 "grid_no_reply", Rd->Host,
3091 Rd->Host, Rd->RUri
3092// ,t1, t0
3093 );
3087 free(t1); 3094 free(t1);
3088 } 3095 }
3089 return ret; 3096 return ret;
@@ -3271,6 +3278,68 @@ t("Write shs %s", tnm4);
3271 free(tnm1); 3278 free(tnm1);
3272 free(tnm0); 3279 free(tnm0);
3273 free(file); 3280 free(file);
3281
3282
3283 if (linky)
3284 {
3285// TODO - send email. Quick and easy is to invoke the sandmail command. Later use libcurl. grid_no_reply@Rd->Host
3286
3287 char *uuid = Rd->shs.UUID, *first = getStrH(Rd->stuff, "firstName"), *last = getStrH(Rd->stuff, "lastName");
3288// TODO - should be from Rd.shs->linky-hashish
3289 char *t0 = Rd->lnk->hashish, *content, *command;
3290
3291 if ('\0' != t0[0])
3292 {
3293 char *t1 = qurl_encode(t0, strlen(t0));
3294
3295 content = xmprintf(
3296 "From: grid_no_reply@%s\n"
3297 "Relpy-to: grid_no_reply@%s\n"
3298 "Return-Path: bounce_email@%s\n"
3299 "To: %s\n"
3300 "Subject: Validate your new account on %s\n"
3301 "\n"
3302 "This is an automated validation email sent from %s.\n"
3303 "\n"
3304 "Dear %s %s,\n"
3305 "\n"
3306 "Some one has created the account '%s %s' on \n"
3307 "https://%s%s, and hopefully it was you.\n"
3308 "If it wasn't you, you can ignore this email.\n"
3309 "\n"
3310 "Please go to this web link to validate your new account -\n"
3311 "https://%s%s?hashish=%s\n"
3312 "\n"
3313 "Do not replay to this email.\n"
3314 "\n",
3315 Rd->Host, Rd->Host, Rd->Host,
3316 getStrH(Rd->stuff, "email"),
3317 Rd->Host, Rd->Host,
3318 first, last,
3319 first, last, Rd->Host, Rd->RUri,
3320 Rd->Host, Rd->RUri, t1
3321 );
3322 l = strlen(content);
3323 file = xmprintf("%s/sessions/%s.email", scCache, shs->leaf);
3324 fd = notstdio(xcreate_stdio(file, O_CREAT | O_WRONLY | O_TRUNC | O_CLOEXEC, S_IRUSR | S_IWUSR));
3325
3326 if (l != writeall(fd, content, l))
3327 {
3328 perror_msg("Writing %s", file);
3329// freeSesh(Rd, linky, TRUE);
3330 }
3331 xclose(fd);
3332 I("Sending linky email to %s %s", getStrH(Rd->stuff, "email"), t1);
3333 command = xmprintf("sendmail -oi -t <%s", file);
3334 int i = system(command);
3335 if (!WIFEXITED(i))
3336 E("sendmail command failed!");
3337 free(command);
3338 free(file);
3339 free(content);
3340 free(t1);
3341 }
3342 }
3274} 3343}
3275 3344
3276 3345
@@ -4004,6 +4073,9 @@ static int emailValidate(reqData *Rd, inputForm *iF, inputValue *iV)
4004static void emailWeb(reqData *Rd, inputForm *oF, inputValue *oV) 4073static void emailWeb(reqData *Rd, inputForm *oF, inputValue *oV)
4005{ 4074{
4006 HTMLtext(Rd->reply, "email", oV->field->title, oV->field->name, displayPrep(getStrH(Rd->stuff, oV->field->name)), oV->field->viewLength, oV->field->maxLength, oV->field->flags & FLD_REQUIRED); 4075 HTMLtext(Rd->reply, "email", oV->field->title, oV->field->name, displayPrep(getStrH(Rd->stuff, oV->field->name)), oV->field->viewLength, oV->field->maxLength, oV->field->flags & FLD_REQUIRED);
4076 Rd->reply->addstrf(Rd->reply, "<p>An email will be sent from %s@%s, and it might be in your spam folder, coz these sorts of emails sometimes end up there. &nbsp; "
4077 "You should add that email address to your contacts, or otherwise let it through your spam filter.</p>",
4078 "grid_no_reply", Rd->Host);
4007} 4079}
4008 4080
4009 4081
@@ -4670,6 +4742,7 @@ static int accountAddSub(reqData *Rd, inputForm *iF, inputValue *iV)
4670 } 4742 }
4671 else 4743 else
4672 { 4744 {
4745
4673 free(h); 4746 free(h);
4674 generateAccountUUID(Rd); 4747 generateAccountUUID(Rd);
4675 Rd->stuff->putstr(Rd->stuff, "passwordHash", getStrH(Rd->stuff, "passHash")); 4748 Rd->stuff->putstr(Rd->stuff, "passwordHash", getStrH(Rd->stuff, "passHash"));
@@ -4684,7 +4757,6 @@ static int accountAddSub(reqData *Rd, inputForm *iF, inputValue *iV)
4684 Rd->output = "accountView"; 4757 Rd->output = "accountView";
4685 Rd->form = "accountView"; 4758 Rd->form = "accountView";
4686 Rd->doit = "login"; 4759 Rd->doit = "login";
4687// TODO - send email. Quick and easy is to invoke the sandmail command. Later use libcurl.
4688 } 4760 }
4689 } 4761 }
4690 freeSesh(Rd, FALSE, wipe); 4762 freeSesh(Rd, FALSE, wipe);