Users using the Tequila login are invited to migrate to gitlab.epfl.ch. This instance will close for Tequila users by May 2020.

Commit 5f426a6b authored by Florian Vessaz's avatar Florian Vessaz

Add new members to the mailing list

parent 0185a362
......@@ -72,6 +72,25 @@ sub members_sort_func {
return $ret;
}
# Temporary: we should make a request to our mlmmj-web app instead.
sub mlmmj_subscribe_member {
my ($mail) = @_;
my $prog = "/usr/local/bin/www-members-mlmmj-sub";
if (not -x $prog) {
warning "Cannot add member to mailing list: $prog is not executable";
return;
}
my $child = open(my $fh, "|-", "sudo", $prog, $mail);
unless ($child) {
warning "Couldn't run $prog: $!";
return;
}
close $fh;
if ($? != 0) {
warning "$prog exited with status $?";
}
}
hook 'before' => sub {
unless (request->path_info =~
m{^/login$|^/session_expired$|^/member/[^/]+/password$})
......@@ -235,6 +254,7 @@ post '/member/:username' => sub {
if (not $mail eq $member->mail) {
$member->mail(params->{mail});
$message .= "Your mail address has been modified.<br/>";
mlmmj_subscribe_member(params->{mail});
}
} else {
$message .= "The mail address you specified is invalid.<br/>";
......@@ -447,6 +467,7 @@ post '/new_member' => sub {
mail::send_welcome_mail(
member => $m,
password_link => $reset_link);
mlmmj_subscribe_member(params->{mail});
return redirect "/member/" . $m->username;
} else {
$message = "Couldn't create new member.";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment