mirror of https://github.com/go-gitea/gitea.git
Minor fix for #2660
This commit is contained in:
parent
5418c2c5e4
commit
baaf6046a1
|
@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
|
|||
|
||||
![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
|
||||
|
||||
##### Current version: 0.8.43
|
||||
##### Current version: 0.8.44
|
||||
|
||||
| Web | UI | Preview |
|
||||
|:-------------:|:-------:|:-------:|
|
||||
|
|
|
@ -250,7 +250,7 @@ func runWeb(ctx *cli.Context) {
|
|||
m.Group("/admin", func() {
|
||||
m.Get("", adminReq, admin.Dashboard)
|
||||
m.Get("/config", admin.Config)
|
||||
m.Get("/config/testmailer", admin.TestMailer)
|
||||
m.Post("/config/test_mail", admin.SendTestMail)
|
||||
m.Get("/monitor", admin.Monitor)
|
||||
|
||||
m.Group("/users", func() {
|
||||
|
|
|
@ -989,7 +989,9 @@ config.mailer_disable_helo = Disable HELO
|
|||
config.mailer_name = Name
|
||||
config.mailer_host = Host
|
||||
config.mailer_user = User
|
||||
config.mailer_test_email = Test Email Settings
|
||||
config.send_test_mail = Send Test Email
|
||||
config.test_mail_failed = Fail to send test email to '%s': %v
|
||||
config.test_mail_sent = Test email has been sent to '%s'.
|
||||
config.oauth_config = OAuth Configuration
|
||||
config.oauth_enabled = Enabled
|
||||
config.cache_config = Cache Configuration
|
||||
|
|
2
gogs.go
2
gogs.go
|
@ -17,7 +17,7 @@ import (
|
|||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
const APP_VER = "0.8.43.0223"
|
||||
const APP_VER = "0.8.44.0224"
|
||||
|
||||
func init() {
|
||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -9,6 +9,7 @@ import (
|
|||
"path"
|
||||
"strings"
|
||||
|
||||
"gopkg.in/gomail.v2"
|
||||
"gopkg.in/macaron.v1"
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
|
@ -184,8 +185,6 @@ func SendCollaboratorMail(r macaron.Render, u, doer *models.User, repo *models.R
|
|||
return nil
|
||||
}
|
||||
|
||||
func SendTestMail(u *models.User) {
|
||||
msg := NewMessage([]string{u.Email}, "Gogs Test Email!", "Gogs Test Email!")
|
||||
|
||||
SendAsync(msg)
|
||||
func SendTestMail(email string) error {
|
||||
return gomail.Send(&Sender{}, NewMessage([]string{email}, "Gogs Test Email!", "Gogs Test Email!").Message)
|
||||
}
|
||||
|
|
|
@ -2551,6 +2551,9 @@ footer .container .links > *:first-child {
|
|||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.admin.config #test-mail-btn {
|
||||
margin-left: 5px;
|
||||
}
|
||||
.explore {
|
||||
padding-top: 15px;
|
||||
padding-bottom: 80px;
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
padding: 20px;
|
||||
margin: 0;
|
||||
|
||||
dd{
|
||||
dd {
|
||||
margin-left: 240px;
|
||||
}
|
||||
dt {
|
||||
|
@ -57,4 +57,10 @@
|
|||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
&.config {
|
||||
#test-mail-btn {
|
||||
margin-left: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -175,9 +175,14 @@ func Dashboard(ctx *middleware.Context) {
|
|||
ctx.HTML(200, DASHBOARD)
|
||||
}
|
||||
|
||||
func TestMailer(ctx *middleware.Context) {
|
||||
// send a test email to the user's email address and redirect back to Config
|
||||
mailer.SendTestMail(ctx.User)
|
||||
func SendTestMail(ctx *middleware.Context) {
|
||||
email := ctx.Query("email")
|
||||
// Send a test email to the user's email address and redirect back to Config
|
||||
if err := mailer.SendTestMail(email); err != nil {
|
||||
ctx.Flash.Error(ctx.Tr("admin.config.test_mail_failed", email, err))
|
||||
} else {
|
||||
ctx.Flash.Info(ctx.Tr("admin.config.test_mail_sent", email))
|
||||
}
|
||||
|
||||
ctx.Redirect(setting.AppSubUrl + "/admin/config")
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
0.8.43.0223
|
||||
0.8.44.0224
|
|
@ -1,5 +1,5 @@
|
|||
{{template "base/head" .}}
|
||||
<div class="admin monitor">
|
||||
<div class="admin config">
|
||||
<div class="ui container">
|
||||
<div class="ui grid">
|
||||
{{template "admin/navbar" .}}
|
||||
|
@ -110,14 +110,23 @@
|
|||
<dt>{{.i18n.Tr "admin.config.mailer_enabled"}}</dt>
|
||||
<dd><i class="fa fa{{if .MailerEnabled}}-check{{end}}-square-o"></i></dd>
|
||||
{{if .MailerEnabled}}<dt>{{.i18n.Tr "admin.config.mailer_name"}}</dt>
|
||||
<dd>{{.Mailer.Name}}</dd>
|
||||
<dt>{{.i18n.Tr "admin.config.mailer_disable_helo"}}</dt>
|
||||
<dd><i class="fa fa{{if .Mailer.DisableHelo}}-check{{end}}-square-o"></i></dd>
|
||||
<dt>{{.i18n.Tr "admin.config.mailer_host"}}</dt>
|
||||
<dd>{{.Mailer.Host}}</dd>
|
||||
<dt>{{.i18n.Tr "admin.config.mailer_user"}}</dt>
|
||||
<dd>{{.Mailer.User}}</dd><br>
|
||||
<a class="ui green button" tabindex="5" href="/admin/config/testmailer">{{.i18n.Tr "admin.config.mailer_test_email"}}</a>{{end}}
|
||||
<dd>{{.Mailer.Name}}</dd>
|
||||
<dt>{{.i18n.Tr "admin.config.mailer_disable_helo"}}</dt>
|
||||
<dd><i class="fa fa{{if .Mailer.DisableHelo}}-check{{end}}-square-o"></i></dd>
|
||||
<dt>{{.i18n.Tr "admin.config.mailer_host"}}</dt>
|
||||
<dd>{{.Mailer.Host}}</dd>
|
||||
<dt>{{.i18n.Tr "admin.config.mailer_user"}}</dt>
|
||||
<dd>{{.Mailer.User}}</dd><br>
|
||||
<form class="ui form" action="{{AppSubUrl}}/admin/config/test_mail" method="post">
|
||||
{{.CsrfTokenHtml}}
|
||||
<div class="inline field ui left">
|
||||
<div class="ui input">
|
||||
<input type="email" name="email" required>
|
||||
</div>
|
||||
</div>
|
||||
<button class="ui green button" id="test-mail-btn">{{.i18n.Tr "admin.config.send_test_mail"}}</button>
|
||||
</form>
|
||||
{{end}}
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue