summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Auth/ReverseProxy.php7
-rw-r--r--config.default.php3
-rw-r--r--docs/reverse-proxy-authentication.markdown5
3 files changed, 14 insertions, 1 deletions
diff --git a/app/Auth/ReverseProxy.php b/app/Auth/ReverseProxy.php
index e23ee24f..361e9634 100644
--- a/app/Auth/ReverseProxy.php
+++ b/app/Auth/ReverseProxy.php
@@ -63,8 +63,13 @@ class ReverseProxy extends Base
*/
private function createUser($login)
{
+ $email = strpos($login, '@') !== false ? $login : '';
+ if (REVERSE_PROXY_DEFAULT_DOMAIN !== '' && empty($email)) {
+ $email = $login . '@' . REVERSE_PROXY_DEFAULT_DOMAIN;
+ }
+
return $this->user->create(array(
- 'email' => strpos($login, '@') !== false ? $login : '',
+ 'email' => $email,
'username' => $login,
'is_admin' => REVERSE_PROXY_DEFAULT_ADMIN === $login,
'is_ldap_user' => 1,
diff --git a/config.default.php b/config.default.php
index 89ba033e..80f965dc 100644
--- a/config.default.php
+++ b/config.default.php
@@ -106,3 +106,6 @@ define('REVERSE_PROXY_USER_HEADER', 'REMOTE_USER');
// Username of the admin, by default blank
define('REVERSE_PROXY_DEFAULT_ADMIN', '');
+
+// Default domain to use for setting the email address
+define('REVERSE_PROXY_DEFAULT_DOMAIN', '');
diff --git a/docs/reverse-proxy-authentication.markdown b/docs/reverse-proxy-authentication.markdown
index c3243208..446adcb8 100644
--- a/docs/reverse-proxy-authentication.markdown
+++ b/docs/reverse-proxy-authentication.markdown
@@ -42,4 +42,9 @@ define('REVERSE_PROXY_USER_HEADER', 'REMOTE_USER');
// you should want to have a bootstrap admin user.
define('REVERSE_PROXY_DEFAULT_ADMIN', 'myadmin');
+// The default domain to assume for the email address.
+// In case the username is not an email address, it
+// will be updated automatically as USER@mydomain.com
+define('REVERSE_PROXY_DEFAULT_DOMAIN', 'mydomain.com');
+
```