forked from Shiloh/githaven
Merge pull request #2660 from joshfng/config-test-mailer
Test mailer button. Addresses #1531
This commit is contained in:
commit
5418c2c5e4
@ -250,6 +250,7 @@ func runWeb(ctx *cli.Context) {
|
|||||||
m.Group("/admin", func() {
|
m.Group("/admin", func() {
|
||||||
m.Get("", adminReq, admin.Dashboard)
|
m.Get("", adminReq, admin.Dashboard)
|
||||||
m.Get("/config", admin.Config)
|
m.Get("/config", admin.Config)
|
||||||
|
m.Get("/config/testmailer", admin.TestMailer)
|
||||||
m.Get("/monitor", admin.Monitor)
|
m.Get("/monitor", admin.Monitor)
|
||||||
|
|
||||||
m.Group("/users", func() {
|
m.Group("/users", func() {
|
||||||
|
@ -989,6 +989,7 @@ config.mailer_disable_helo = Disable HELO
|
|||||||
config.mailer_name = Name
|
config.mailer_name = Name
|
||||||
config.mailer_host = Host
|
config.mailer_host = Host
|
||||||
config.mailer_user = User
|
config.mailer_user = User
|
||||||
|
config.mailer_test_email = Test Email Settings
|
||||||
config.oauth_config = OAuth Configuration
|
config.oauth_config = OAuth Configuration
|
||||||
config.oauth_enabled = Enabled
|
config.oauth_enabled = Enabled
|
||||||
config.cache_config = Cache Configuration
|
config.cache_config = Cache Configuration
|
||||||
|
File diff suppressed because one or more lines are too long
@ -183,3 +183,9 @@ func SendCollaboratorMail(r macaron.Render, u, doer *models.User, repo *models.R
|
|||||||
SendAsync(msg)
|
SendAsync(msg)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SendTestMail(u *models.User) {
|
||||||
|
msg := NewMessage([]string{u.Email}, "Gogs Test Email!", "Gogs Test Email!")
|
||||||
|
|
||||||
|
SendAsync(msg)
|
||||||
|
}
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
"github.com/gogits/gogs/models"
|
"github.com/gogits/gogs/models"
|
||||||
"github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
"github.com/gogits/gogs/modules/cron"
|
"github.com/gogits/gogs/modules/cron"
|
||||||
|
"github.com/gogits/gogs/modules/mailer"
|
||||||
"github.com/gogits/gogs/modules/middleware"
|
"github.com/gogits/gogs/modules/middleware"
|
||||||
"github.com/gogits/gogs/modules/process"
|
"github.com/gogits/gogs/modules/process"
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
@ -174,6 +175,13 @@ func Dashboard(ctx *middleware.Context) {
|
|||||||
ctx.HTML(200, DASHBOARD)
|
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)
|
||||||
|
|
||||||
|
ctx.Redirect(setting.AppSubUrl + "/admin/config")
|
||||||
|
}
|
||||||
|
|
||||||
func Config(ctx *middleware.Context) {
|
func Config(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("admin.config")
|
ctx.Data["Title"] = ctx.Tr("admin.config")
|
||||||
ctx.Data["PageIsAdmin"] = true
|
ctx.Data["PageIsAdmin"] = true
|
||||||
|
@ -116,7 +116,8 @@
|
|||||||
<dt>{{.i18n.Tr "admin.config.mailer_host"}}</dt>
|
<dt>{{.i18n.Tr "admin.config.mailer_host"}}</dt>
|
||||||
<dd>{{.Mailer.Host}}</dd>
|
<dd>{{.Mailer.Host}}</dd>
|
||||||
<dt>{{.i18n.Tr "admin.config.mailer_user"}}</dt>
|
<dt>{{.i18n.Tr "admin.config.mailer_user"}}</dt>
|
||||||
<dd>{{.Mailer.User}}</dd>{{end}}
|
<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}}
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user