Browse Source

Minor fix for #2660

pull/2706/head
Unknwon 9 years ago
parent
commit
baaf6046a1
  1. 2
      README.md
  2. 2
      cmd/web.go
  3. 4
      conf/locale/locale_en-US.ini
  4. 2
      gogs.go
  5. 1596
      modules/bindata/bindata.go
  6. 7
      modules/mailer/mail.go
  7. 3
      public/css/gogs.css
  8. 8
      public/less/_admin.less
  9. 11
      routers/admin/admin.go
  10. 2
      templates/.VERSION
  11. 27
      templates/admin/config.tmpl

2
README.md

@ -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 |
|:-------------:|:-------:|:-------:|

2
cmd/web.go

@ -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() {

4
conf/locale/locale_en-US.ini

@ -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

@ -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())

1596
modules/bindata/bindata.go

File diff suppressed because one or more lines are too long

7
modules/mailer/mail.go

@ -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)
}

3
public/css/gogs.css

@ -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;

8
public/less/_admin.less

@ -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;
}
}
}

11
routers/admin/admin.go

@ -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")
}

2
templates/.VERSION

@ -1 +1 @@
0.8.43.0223
0.8.44.0224

27
templates/admin/config.tmpl

@ -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…
Cancel
Save