summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorderSuessmann <derSuessmann@users.noreply.github.com>2017-01-08 04:12:03 +0100
committerLunny Xiao <xiaolunwen@gmail.com>2017-01-08 11:12:03 +0800
commit51d578ff3321e173b0dae4c80d3031fb0492656d (patch)
tree8297ce73af221f98bff148c1d7cfa7c82a0580a6 /templates
parent6072b032918006824f260e79f96372dd94fbb17f (diff)
downloadgitea-51d578ff3321e173b0dae4c80d3031fb0492656d.tar.gz
gitea-51d578ff3321e173b0dae4c80d3031fb0492656d.zip
Add Keep email private (see issue #571). (#571)
- Add site-wide option DEFAULT_KEEP_EMAIL_PRIVATE. - Add the new option to the install and admin/config pages. - Add the new option to app.ini in the service section. - Add the new option to the settings struct. - Add English text strings to i18n. - Add field KeepEmailPrivate to user struct. - Add field KeepEmailPrivate to user form. - Add option to UI. - Add using noreply email address if user has "Keep Email Private". An email address <LowerName>@<NO_REPLY_ADDRESS> is now used in commit messages (and hopefully all other git log relevant places). The change relies on the fact that git commands should use user.NetGitSig(). - Add hiding of email address in UI, if user has set "Keep Email Private". - Add condition to show email address only on explore/users and user pages, if user has not set "Keep Email Private". - Add noreply email in API if set "Keep Email Private". - Add a new service setting NO_REPLY_ADDRESS. The value of this setting is used as the domain part for the user's email address in git log, iff he decides to keep his email address private. If the user decides to keep his email address private and this option is not set 'noreply.example.org' is used, which no MTA should send email to. Add NO_REPLY_ADDRESS to conf/app.ini.
Diffstat (limited to 'templates')
-rw-r--r--templates/admin/config.tmpl4
-rw-r--r--templates/explore/users.tmpl2
-rw-r--r--templates/install.tmpl11
-rw-r--r--templates/user/profile.tmpl2
-rw-r--r--templates/user/settings/profile.tmpl6
5 files changed, 23 insertions, 2 deletions
diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl
index 94a2a2fcc5..f0c349b1de 100644
--- a/templates/admin/config.tmpl
+++ b/templates/admin/config.tmpl
@@ -119,6 +119,10 @@
<dd><i class="fa fa{{if .Service.DisableMinimumKeySizeCheck}}-check{{end}}-square-o"></i></dd>*/}}
<dt>{{.i18n.Tr "admin.config.enable_captcha"}}</dt>
<dd><i class="fa fa{{if .Service.EnableCaptcha}}-check{{end}}-square-o"></i></dd>
+ <dt>{{.i18n.Tr "admin.config.default_keep_email_private"}}</dt>
+ <dd><i class="fa fa{{if .Service.DefaultKeepEmailPrivate}}-check{{end}}-square-o"></i></dd>
+ <dt>{{.i18n.Tr "admin.config.no_reply_address"}}</dt>
+ <dd>{{if .Service.NoReplyAddress}}{{.Service.NoReplyAddress}}{{else}}-{{end}}</dd>
<div class="ui divider"></div>
<dt>{{.i18n.Tr "admin.config.active_code_lives"}}</dt>
<dd>{{.Service.ActiveCodeLives}} {{.i18n.Tr "tool.raw_minutes"}}</dd>
diff --git a/templates/explore/users.tmpl b/templates/explore/users.tmpl
index 84ab7ad7fb..1fbe8653b3 100644
--- a/templates/explore/users.tmpl
+++ b/templates/explore/users.tmpl
@@ -16,7 +16,7 @@
{{if .Location}}
<i class="octicon octicon-location"></i> {{.Location}}
{{end}}
- {{if and $.ShowUserEmail .Email $.IsSigned}}
+ {{if and $.ShowUserEmail .Email $.IsSigned (not .KeepEmailPrivate)}}
<i class="octicon octicon-mail"></i>
<a href="mailto:{{.Email}}" rel="nofollow">{{.Email}}</a>
{{end}}
diff --git a/templates/install.tmpl b/templates/install.tmpl
index 027d06166b..3489b72ebf 100644
--- a/templates/install.tmpl
+++ b/templates/install.tmpl
@@ -206,6 +206,17 @@
<input name="require_sign_in_view" type="checkbox" {{if .require_sign_in_view}}checked{{end}}>
</div>
</div>
+ <div class="inline field">
+ <div class="ui checkbox">
+ <label class="poping up" data-content="{{.i18n.Tr "install.default_keep_email_private_popup"}}"><strong>{{.i18n.Tr "install.default_keep_email_private"}}</strong></label>
+ <input name="default_keep_email_private" type="checkbox" {{if .default_keep_email_private}}checked{{end}}>
+ </div>
+ </div>
+ <div class="inline field">
+ <label for="no_reply_address">{{.i18n.Tr "install.no_reply_address"}}</label>
+ <input id="_no_reply_address" name="no_reply_address" value="{{.no_reply_address}}">
+ <span class="help">{{.i18n.Tr "install.no_reply_address_helper"}}</span>
+ </div>
</div>
</div>
diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl
index 37f94d2b79..198a9e3b60 100644
--- a/templates/user/profile.tmpl
+++ b/templates/user/profile.tmpl
@@ -22,7 +22,7 @@
{{if .Owner.Location}}
<li><i class="octicon octicon-location"></i> {{.Owner.Location}}</li>
{{end}}
- {{if and $.ShowUserEmail .Owner.Email .IsSigned}}
+ {{if or (and $.ShowUserEmail .Owner.Email .IsSigned) (and .Owner.Email .IsSigned (not .Owner.KeepEmailPrivate))}}
<li>
<i class="octicon octicon-mail"></i>
<a href="mailto:{{.Owner.Email}}" rel="nofollow">{{.Owner.Email}}</a>
diff --git a/templates/user/settings/profile.tmpl b/templates/user/settings/profile.tmpl
index a42d9c49c3..f01e6e9739 100644
--- a/templates/user/settings/profile.tmpl
+++ b/templates/user/settings/profile.tmpl
@@ -27,6 +27,12 @@
<label for="email">{{.i18n.Tr "email"}}</label>
<input id="email" name="email" value="{{.SignedUser.Email}}">
</div>
+ <div class="inline field">
+ <div class="ui checkbox" id="keep-email-private">
+ <label class="poping up" data-content="{{.i18n.Tr "settings.keep_email_private_popup"}}"><strong>{{.i18n.Tr "settings.keep_email_private"}}</strong></label>
+ <input name="keep_email_private" type="checkbox" {{if .SignedUser.KeepEmailPrivate}}checked{{end}}>
+ </div>
+ </div>
<div class="field {{if .Err_Website}}error{{end}}">
<label for="website">{{.i18n.Tr "settings.website"}}</label>
<input id="website" name="website" type="url" value="{{.SignedUser.Website}}">