]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/emailauth.pm
Merge branch 'master' into debian-jessie-backports
[git.ikiwiki.info.git] / IkiWiki / Plugin / emailauth.pm
index 5e74ce8f60c9b90768fbb44aa29e2ae9c327d637..6674fe3d6b07b91ec9daf0d3276fa8936fc66378 100644 (file)
@@ -26,6 +26,12 @@ sub getsetup () {
                        rebuild => 0,
                        section => "auth",
                },
                        rebuild => 0,
                        section => "auth",
                },
+               emailauth_sender => {
+                       type => "string",
+                       description => "email address to send emailauth mails as (default: adminemail)",
+                       safe => 1,
+                       rebuild => 0,
+               },
 }
 
 sub email_setup ($$) {
 }
 
 sub email_setup ($$) {
@@ -78,12 +84,16 @@ sub email_auth ($$$$) {
        
        eval q{use Mail::Sendmail};
        error($@) if $@;
        
        eval q{use Mail::Sendmail};
        error($@) if $@;
+       my $shorturl=$config{url};
+       $shorturl=~s/^https?:\/\///i;
+       my $emailauth_sender=$config{emailauth_sender};
+       $emailauth_sender=$config{adminemail} unless defined $emailauth_sender;
        sendmail(
                To => $email,
                From => "$config{wikiname} admin <".
        sendmail(
                To => $email,
                From => "$config{wikiname} admin <".
-                       (defined $config{adminemail} ? $config{adminemail} : "")
+                       (defined $emailauth_sender ? $emailauth_sender : "")
                        .">",
                        .">",
-               Subject => "$config{wikiname} ( ".$config{url}." ) login",
+               Subject => "$config{wikiname} login | $shorturl",
                Message => $template->output,
        ) or error(gettext("Failed to send mail"));
 
                Message => $template->output,
        ) or error(gettext("Failed to send mail"));