templates/user/settings/emial.tmpl: little fix on UI
- routers/user: little code format - conf/locale: update French locale
This commit is contained in:
parent
065f8d1f56
commit
1654e9ecab
8 changed files with 58 additions and 64 deletions
|
@ -59,8 +59,8 @@ run_user=Entrer un Utilisateur
|
||||||
run_user_helper=L'utilisateur doit avoir accès à la Racine du Référentiel et éxécuter Gogs.
|
run_user_helper=L'utilisateur doit avoir accès à la Racine du Référentiel et éxécuter Gogs.
|
||||||
domain=Domaine
|
domain=Domaine
|
||||||
domain_helper=Cela affecte les doublons d'URL SSH.
|
domain_helper=Cela affecte les doublons d'URL SSH.
|
||||||
http_port=HTTP Port
|
http_port=Port HTTP
|
||||||
http_port_helper=Port number which application will listen on.
|
http_port_helper=Numéro de port que l'application écoutera.
|
||||||
app_url=URL de l'Application
|
app_url=URL de l'Application
|
||||||
app_url_helper=Cela affecte les doublons d'URL HTTP/HTTPS et le contenu d'e-mail.
|
app_url_helper=Cela affecte les doublons d'URL HTTP/HTTPS et le contenu d'e-mail.
|
||||||
email_title=Paramètres du Service de Messagerie (Facultatif)
|
email_title=Paramètres du Service de Messagerie (Facultatif)
|
||||||
|
@ -514,10 +514,10 @@ dashboard.delete_repo_archives=Supprimer toutes les archives de référentiels
|
||||||
dashboard.delete_repo_archives_success=Toutes les archives de référentiels ont été supprimés avec succès.
|
dashboard.delete_repo_archives_success=Toutes les archives de référentiels ont été supprimés avec succès.
|
||||||
dashboard.git_gc_repos=Collecter les déchets des référentiels
|
dashboard.git_gc_repos=Collecter les déchets des référentiels
|
||||||
dashboard.git_gc_repos_success=Tous les référentiels ont effectué la collecte avec succès.
|
dashboard.git_gc_repos_success=Tous les référentiels ont effectué la collecte avec succès.
|
||||||
dashboard.resync_all_sshkeys=Rewrite '.ssh/autorized_key' file (caution: non-Gogs keys will be lost)
|
dashboard.resync_all_sshkeys=Ré-écrire le fichier '.ssh/autorized_key' (attention : les clés hors-Gogs vont être perdues)
|
||||||
dashboard.resync_all_sshkeys_success=All public keys have been rewritten successfully.
|
dashboard.resync_all_sshkeys_success=Toutes les clés publiques ont été ré-écrites avec succès.
|
||||||
dashboard.resync_all_update_hooks=Rewrite all update hook of repositories (needed when custom config path is changed)
|
dashboard.resync_all_update_hooks=Ré-écrire tous les hooks de mises à jour des dépôts (requis quand le chemin de la configuration personnalisé est modifié)
|
||||||
dashboard.resync_all_update_hooks_success=All repositories' update hook have been rewritten successfully.
|
dashboard.resync_all_update_hooks_success=Tous les hooks de mises à jour des dépôts ont été ré-écris avec succès.
|
||||||
|
|
||||||
dashboard.server_uptime=Durée de Marche Serveur
|
dashboard.server_uptime=Durée de Marche Serveur
|
||||||
dashboard.current_goroutine=Goroutines actuelles
|
dashboard.current_goroutine=Goroutines actuelles
|
||||||
|
@ -638,7 +638,7 @@ config.db_path_helper=("sqlite3" uniquement)
|
||||||
config.service_config=Configuration du Service
|
config.service_config=Configuration du Service
|
||||||
config.register_email_confirm=Nécessite une confirmation par courriel
|
config.register_email_confirm=Nécessite une confirmation par courriel
|
||||||
config.disable_register=Désactiver l'Enregistrement
|
config.disable_register=Désactiver l'Enregistrement
|
||||||
config.show_registration_button=Show Register Button
|
config.show_registration_button=Afficher le bouton d'enregistrement
|
||||||
config.require_sign_in_view=Connexion Obligatoire pour Visualiser
|
config.require_sign_in_view=Connexion Obligatoire pour Visualiser
|
||||||
config.mail_notify=Mailer les Notifications
|
config.mail_notify=Mailer les Notifications
|
||||||
config.enable_cache_avatar=Activer le Cache d'Avatar
|
config.enable_cache_avatar=Activer le Cache d'Avatar
|
||||||
|
@ -647,7 +647,7 @@ config.reset_password_code_lives=Réinitialiser le Mot De Passe des Limites de C
|
||||||
config.webhook_config=Configuration Webhook
|
config.webhook_config=Configuration Webhook
|
||||||
config.task_interval=Intervalles de Tâches
|
config.task_interval=Intervalles de Tâches
|
||||||
config.deliver_timeout=Expiration d'Envoi
|
config.deliver_timeout=Expiration d'Envoi
|
||||||
config.skip_tls_verify=Skip TLS Verify
|
config.skip_tls_verify=Ne pas vérifier TLS
|
||||||
config.mailer_config=Configuration du Maileur
|
config.mailer_config=Configuration du Maileur
|
||||||
config.mailer_enabled=Activé
|
config.mailer_enabled=Activé
|
||||||
config.mailer_name=Nom
|
config.mailer_name=Nom
|
||||||
|
|
2
gogs.go
2
gogs.go
|
@ -17,7 +17,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.5.13.0214 Beta"
|
const APP_VER = "0.5.14.0221 Beta"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
|
@ -627,7 +627,7 @@ func GetUserIdsByNames(names []string) []int64 {
|
||||||
return ids
|
return ids
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all email addresses
|
// GetEmailAddresses returns all e-mail addresses belongs to given user.
|
||||||
func GetEmailAddresses(uid int64) ([]*EmailAddress, error) {
|
func GetEmailAddresses(uid int64) ([]*EmailAddress, error) {
|
||||||
emails := make([]*EmailAddress, 0, 5)
|
emails := make([]*EmailAddress, 0, 5)
|
||||||
err := x.Where("uid=?", uid).Find(&emails)
|
err := x.Where("uid=?", uid).Find(&emails)
|
||||||
|
@ -641,7 +641,6 @@ func GetEmailAddresses(uid int64) ([]*EmailAddress, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
isPrimaryFound := false
|
isPrimaryFound := false
|
||||||
|
|
||||||
for _, email := range emails {
|
for _, email := range emails {
|
||||||
if email.Email == u.Email {
|
if email.Email == u.Email {
|
||||||
isPrimaryFound = true
|
isPrimaryFound = true
|
||||||
|
@ -654,7 +653,11 @@ func GetEmailAddresses(uid int64) ([]*EmailAddress, error) {
|
||||||
// We alway want the primary email address displayed, even if it's not in
|
// We alway want the primary email address displayed, even if it's not in
|
||||||
// the emailaddress table (yet)
|
// the emailaddress table (yet)
|
||||||
if !isPrimaryFound {
|
if !isPrimaryFound {
|
||||||
emails = append(emails, &EmailAddress{Email: u.Email, IsActivated: true, IsPrimary: true})
|
emails = append(emails, &EmailAddress{
|
||||||
|
Email: u.Email,
|
||||||
|
IsActivated: true,
|
||||||
|
IsPrimary: true,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
return emails, nil
|
return emails, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ func (f *UploadAvatarForm) Validate(ctx *macaron.Context, errs binding.Errors) b
|
||||||
}
|
}
|
||||||
|
|
||||||
type AddEmailForm struct {
|
type AddEmailForm struct {
|
||||||
Email string `form:"email" binding:"Required;Email;MaxSize(50)"`
|
Email string `binding:"Required;Email;MaxSize(50)"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *AddEmailForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
|
func (f *AddEmailForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
|
||||||
|
|
|
@ -351,15 +351,12 @@ func ActivateEmail(ctx *middleware.Context) {
|
||||||
|
|
||||||
// Verify code.
|
// Verify code.
|
||||||
if email := models.VerifyActiveEmailCode(code, email_string); email != nil {
|
if email := models.VerifyActiveEmailCode(code, email_string); email != nil {
|
||||||
err := email.Activate()
|
if err := email.Activate(); err != nil {
|
||||||
if err != nil {
|
|
||||||
ctx.Handle(500, "ActivateEmail", err)
|
ctx.Handle(500, "ActivateEmail", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Trace("Email activated: %s", email.Email)
|
log.Trace("Email activated: %s", email.Email)
|
||||||
|
|
||||||
ctx.Flash.Success(ctx.Tr("settings.activate_email_success"))
|
ctx.Flash.Success(ctx.Tr("settings.activate_email_success"))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/email")
|
ctx.Redirect(setting.AppSubUrl + "/user/settings/email")
|
||||||
|
|
|
@ -133,13 +133,12 @@ func SettingsEmails(ctx *middleware.Context) {
|
||||||
ctx.Data["PageIsUserSettings"] = true
|
ctx.Data["PageIsUserSettings"] = true
|
||||||
ctx.Data["PageIsSettingsEmails"] = true
|
ctx.Data["PageIsSettingsEmails"] = true
|
||||||
|
|
||||||
var err error
|
emails, err := models.GetEmailAddresses(ctx.User.Id)
|
||||||
ctx.Data["Emails"], err = models.GetEmailAddresses(ctx.User.Id)
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "email.GetEmailAddresses", err)
|
ctx.Handle(500, "GetEmailAddresses", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
ctx.Data["Emails"] = emails
|
||||||
|
|
||||||
ctx.HTML(200, SETTINGS_EMAILS)
|
ctx.HTML(200, SETTINGS_EMAILS)
|
||||||
}
|
}
|
||||||
|
@ -149,16 +148,16 @@ func SettingsEmailPost(ctx *middleware.Context, form auth.AddEmailForm) {
|
||||||
ctx.Data["PageIsUserSettings"] = true
|
ctx.Data["PageIsUserSettings"] = true
|
||||||
ctx.Data["PageIsSettingsEmails"] = true
|
ctx.Data["PageIsSettingsEmails"] = true
|
||||||
|
|
||||||
var err error
|
emails, err := models.GetEmailAddresses(ctx.User.Id)
|
||||||
ctx.Data["Emails"], err = models.GetEmailAddresses(ctx.User.Id)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "email.GetEmailAddresses", err)
|
ctx.Handle(500, "GetEmailAddresses", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
ctx.Data["Emails"] = emails
|
||||||
|
|
||||||
// Delete Email address.
|
// Delete E-mail address.
|
||||||
if ctx.Query("_method") == "DELETE" {
|
if ctx.Query("_method") == "DELETE" {
|
||||||
id := com.StrTo(ctx.Query("id")).MustInt64()
|
id := ctx.QueryInt64("id")
|
||||||
if id <= 0 {
|
if id <= 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -174,7 +173,7 @@ func SettingsEmailPost(ctx *middleware.Context, form auth.AddEmailForm) {
|
||||||
|
|
||||||
// Make emailaddress primary.
|
// Make emailaddress primary.
|
||||||
if ctx.Query("_method") == "PRIMARY" {
|
if ctx.Query("_method") == "PRIMARY" {
|
||||||
id := com.StrTo(ctx.Query("id")).MustInt64()
|
id := ctx.QueryInt64("id")
|
||||||
if id <= 0 {
|
if id <= 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -189,46 +188,41 @@ func SettingsEmailPost(ctx *middleware.Context, form auth.AddEmailForm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add Email address.
|
// Add Email address.
|
||||||
if ctx.Req.Method == "POST" {
|
if ctx.HasError() {
|
||||||
if ctx.HasError() {
|
ctx.HTML(200, SETTINGS_EMAILS)
|
||||||
ctx.HTML(200, SETTINGS_EMAILS)
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanEmail := strings.Replace(form.Email, "\n", "", -1)
|
||||||
|
e := &models.EmailAddress{
|
||||||
|
Uid: ctx.User.Id,
|
||||||
|
Email: cleanEmail,
|
||||||
|
IsActivated: !setting.Service.RegisterEmailConfirm,
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := models.AddEmailAddress(e); err != nil {
|
||||||
|
if err == models.ErrEmailAlreadyUsed {
|
||||||
|
ctx.RenderWithErr(ctx.Tr("form.email_been_used"), SETTINGS_EMAILS, &form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
ctx.Handle(500, "AddEmailAddress", err)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
// Send confirmation e-mail
|
||||||
|
if setting.Service.RegisterEmailConfirm {
|
||||||
|
mailer.SendActivateEmail(ctx.Render, ctx.User, e)
|
||||||
|
|
||||||
cleanEmail := strings.Replace(form.Email, "\n", "", -1)
|
if err := ctx.Cache.Put("MailResendLimit_"+ctx.User.LowerName, ctx.User.LowerName, 180); err != nil {
|
||||||
e := &models.EmailAddress{
|
log.Error(4, "Set cache(MailResendLimit) fail: %v", err)
|
||||||
Uid: ctx.User.Id,
|
|
||||||
Email: cleanEmail,
|
|
||||||
IsActivated: !setting.Service.RegisterEmailConfirm,
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := models.AddEmailAddress(e); err != nil {
|
|
||||||
if err == models.ErrEmailAlreadyUsed {
|
|
||||||
ctx.RenderWithErr(ctx.Tr("form.email_has_been_used"), SETTINGS_EMAILS, &form)
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
ctx.Handle(500, "email.AddEmailAddress", err)
|
ctx.Flash.Success(ctx.Tr("settings.add_email_success_confirmation_email_sent"))
|
||||||
return
|
|
||||||
} else {
|
} else {
|
||||||
|
ctx.Flash.Success(ctx.Tr("settings.add_email_success"))
|
||||||
// Send confirmation e-mail
|
|
||||||
if setting.Service.RegisterEmailConfirm {
|
|
||||||
mailer.SendActivateEmail(ctx.Render, ctx.User, e)
|
|
||||||
|
|
||||||
if err := ctx.Cache.Put("MailResendLimit_"+ctx.User.LowerName, ctx.User.LowerName, 180); err != nil {
|
|
||||||
log.Error(4, "Set cache(MailResendLimit) fail: %v", err)
|
|
||||||
}
|
|
||||||
ctx.Flash.Success(ctx.Tr("settings.add_email_success_confirmation_email_sent"))
|
|
||||||
} else {
|
|
||||||
ctx.Flash.Success(ctx.Tr("settings.add_email_success"))
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Trace("Email address added: %s", e.Email)
|
|
||||||
|
|
||||||
ctx.Redirect(setting.AppSubUrl + "/user/settings/email")
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Trace("Email address added: %s", e.Email)
|
||||||
|
ctx.Redirect(setting.AppSubUrl + "/user/settings/email")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.HTML(200, SETTINGS_EMAILS)
|
ctx.HTML(200, SETTINGS_EMAILS)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.5.13.0214 Beta
|
0.5.14.0221 Beta
|
|
@ -16,7 +16,7 @@
|
||||||
{{range .Emails}}
|
{{range .Emails}}
|
||||||
<li class="email clear">
|
<li class="email clear">
|
||||||
<div class="email-content left">
|
<div class="email-content left">
|
||||||
<p><strong>{{.Email}}</strong> {{if .IsPrimary}} <span class="email-primary">{{$.i18n.Tr "settings.primary"}}</span> {{end}}</p>
|
<p><strong>{{.Email}}</strong> {{if .IsPrimary}} <span class="text-red">{{$.i18n.Tr "settings.primary"}}</span> {{end}}</p>
|
||||||
</div>
|
</div>
|
||||||
{{if not .IsPrimary}}
|
{{if not .IsPrimary}}
|
||||||
{{if .IsActivated}}
|
{{if .IsActivated}}
|
||||||
|
@ -24,14 +24,14 @@
|
||||||
{{$.CsrfTokenHtml}}
|
{{$.CsrfTokenHtml}}
|
||||||
<input name="_method" type="hidden" value="PRIMARY">
|
<input name="_method" type="hidden" value="PRIMARY">
|
||||||
<input name="id" type="hidden" value="{{.Id}}">
|
<input name="id" type="hidden" value="{{.Id}}">
|
||||||
<button class="right email-btn btn btn-green btn-radius btn-small">{{$.i18n.Tr "settings.primary_email"}}</button>
|
<button class="right email-btn btn btn-small btn-green btn-radius">{{$.i18n.Tr "settings.primary_email"}}</button>
|
||||||
</form>
|
</form>
|
||||||
{{end}}
|
{{end}}
|
||||||
<form action="{{AppSubUrl}}/user/settings/email" method="post">
|
<form action="{{AppSubUrl}}/user/settings/email" method="post">
|
||||||
{{$.CsrfTokenHtml}}
|
{{$.CsrfTokenHtml}}
|
||||||
<input name="_method" type="hidden" value="DELETE">
|
<input name="_method" type="hidden" value="DELETE">
|
||||||
<input name="id" type="hidden" value="{{.Id}}">
|
<input name="id" type="hidden" value="{{.Id}}">
|
||||||
<button class="right email-btn btn btn-red btn-radius btn-small">{{$.i18n.Tr "settings.delete_email"}}</button>
|
<button class="right email-btn btn btn-small btn-red btn-radius" style="margin-right: 5px">{{$.i18n.Tr "settings.delete_email"}}</button>
|
||||||
</form>
|
</form>
|
||||||
{{end}}
|
{{end}}
|
||||||
</li>
|
</li>
|
||||||
|
|
Reference in a new issue