-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from tobychui/v3.0.3
Update V3.0.3 - Updated SMTP UI for non email login username - Fixed ACME cert store reload after cert request - Fixed default rule not applying to default site when default site is set to proxy target - Fixed blacklist-ip not working with CIDR bug - Fixed minor vdir bug in tailing slash detection and redirect logic - Added custom mdns name support (-mdnsname flag) - Added LAN tag in statistic
- Loading branch information
Showing
14 changed files
with
85 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,18 +13,16 @@ import ( | |
|
||
type Sender struct { | ||
Hostname string //E.g. mail.gandi.net | ||
Domain string //E.g. arozos.com | ||
Port int //E.g. 587 | ||
Username string //Username of the email account | ||
Password string //Password of the email account | ||
SenderAddr string //e.g. [email protected] | ||
} | ||
|
||
//Create a new email sender object | ||
func NewEmailSender(hostname string, domain string, port int, username string, password string, senderAddr string) *Sender { | ||
// Create a new email sender object | ||
func NewEmailSender(hostname string, port int, username string, password string, senderAddr string) *Sender { | ||
return &Sender{ | ||
Hostname: hostname, | ||
Domain: domain, | ||
Port: port, | ||
Username: username, | ||
Password: password, | ||
|
@@ -33,13 +31,15 @@ func NewEmailSender(hostname string, domain string, port int, username string, p | |
} | ||
|
||
/* | ||
Send a email to a reciving addr | ||
Example Usage: | ||
SendEmail( | ||
[email protected], | ||
"Free donuts", | ||
"Come get your free donuts on this Sunday!" | ||
) | ||
Send a email to a reciving addr | ||
Example Usage: | ||
SendEmail( | ||
[email protected], | ||
"Free donuts", | ||
"Come get your free donuts on this Sunday!" | ||
) | ||
*/ | ||
func (s *Sender) SendEmail(to string, subject string, content string) error { | ||
//Parse the email content | ||
|
@@ -50,7 +50,9 @@ func (s *Sender) SendEmail(to string, subject string, content string) error { | |
content + "\n\n") | ||
|
||
//Login to the SMTP server | ||
auth := smtp.PlainAuth("", s.Username+"@"+s.Domain, s.Password, s.Hostname) | ||
//Username can be username (e.g. admin) or email (e.g. [email protected]), depending on SMTP service provider | ||
auth := smtp.PlainAuth("", s.Username, s.Password, s.Hostname) | ||
|
||
err := smtp.SendMail(s.Hostname+":"+strconv.Itoa(s.Port), auth, s.SenderAddr, []string{to}, msg) | ||
if err != nil { | ||
return err | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,21 +65,9 @@ <h3>Forget Password Email</h3> | |
|
||
<div class="field"> | ||
<p><i class="caret down icon"></i> Credentials for SMTP server authentications</p> | ||
<div class="two fields"> | ||
<div class="field"> | ||
<label>Sender Username</label> | ||
<input type="text" name="username" placeholder="E.g. admin"> | ||
</div> | ||
|
||
<div class="field"> | ||
<label>Sender Domain</label> | ||
<div class="ui labeled input"> | ||
<div class="ui basic label"> | ||
@ | ||
</div> | ||
<input type="text" name="domain" min="1" max="65534" placeholder="E.g. arozos.com"> | ||
</div> | ||
</div> | ||
<div class="field"> | ||
<label>Sender Username / Email</label> | ||
<input type="text" name="username" placeholder="e.g. admin or [email protected]"> | ||
</div> | ||
</div> | ||
<div class="field"> | ||
|
@@ -272,7 +260,6 @@ <h3 class="ui header"> | |
e.preventDefault(); | ||
var data = { | ||
hostname: $('input[name=hostname]').val(), | ||
domain: $('input[name=domain]').val(), | ||
port: parseInt($('input[name=port]').val()), | ||
username: $('input[name=username]').val(), | ||
password: $('input[name=password]').val(), | ||
|
@@ -306,7 +293,6 @@ <h3 class="ui header"> | |
function initSMTPSettings(){ | ||
$.get("/api/tools/smtp/get", function(data){ | ||
$('#email-form input[name=hostname]').val(data.Hostname); | ||
$('#email-form input[name=domain]').val(data.Domain); | ||
$('#email-form input[name=port]').val(data.Port); | ||
$('#email-form input[name=username]').val(data.Username); | ||
$('#email-form input[name=senderAddr]').val(data.SenderAddr); | ||
|
@@ -345,14 +331,6 @@ <h3 class="ui header"> | |
form.find('input[name="hostname"]').parent().removeClass('error'); | ||
} | ||
|
||
// validate domain | ||
const domain = form.find('input[name="domain"]').val().trim(); | ||
if (!domainRegex.test(domain)) { | ||
form.find('input[name="domain"]').parent().addClass('error'); | ||
isValid = false; | ||
} else { | ||
form.find('input[name="domain"]').parent().removeClass('error'); | ||
} | ||
|
||
// validate username | ||
const username = form.find('input[name="username"]').val().trim(); | ||
|