Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Update settings and docs with email verification infos

Roland Geider33293b6f4e7a
diff --git a/docs/production.rst b/docs/production.rst
index d1ccd89ce..51b389c05 100644
--- a/docs/production.rst
+++ b/docs/production.rst
@@ -184,6 +184,18 @@ where ``wger.example.com`` is the domain of the wger instance. This assumes that
SITE_ID = 2
+
+To verify the user's email and allow them to submit and edit exercises, the domain
+is configured differently. You will want to set::
+
+ EMAIL_PAGE_DOMAIN = 'https://wger.de/'
+
+in the settings (as well as a properly configured email backend). Consult the documentation
+for the `django-email-verification`_ app for more details
+
+.. _`django-email-verification`: https://pypi.org/project/django-email-verification/
+
+
.. _other-changes:
Other changes
diff --git a/extras/docker/development/settings.py b/extras/docker/development/settings.py
index 9338fbf94..64246704d 100644
--- a/extras/docker/development/settings.py
+++ b/extras/docker/development/settings.py
@@ -101,3 +101,6 @@ if os.environ.get("DJANGO_CACHE_BACKEND"):
}
}
}
+
+# The site's domain as used by the email verification workflow
+EMAIL_PAGE_DOMAIN = 'http://localhost/'
diff --git a/wger/core/api/viewsets.py b/wger/core/api/viewsets.py
index 36d4259fb..e707259c0 100644
--- a/wger/core/api/viewsets.py
+++ b/wger/core/api/viewsets.py
@@ -14,6 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# Third Party
from rest_framework import mixins
from rest_framework.viewsets import GenericViewSet
diff --git a/wger/settings.tpl b/wger/settings.tpl
index a2c686647..9b7cf6545 100644
--- a/wger/settings.tpl
+++ b/wger/settings.tpl
@@ -66,5 +66,8 @@ if DEBUG:
WGER_SETTINGS['EMAIL_FROM'] = 'wger Workout Manager <[email protected]>'
DEFAULT_FROM_EMAIL = WGER_SETTINGS['EMAIL_FROM']
+# The site's domain as used by the email verification workflow
+EMAIL_PAGE_DOMAIN = 'https://wger.de/'
+
# Your twitter handle, if you have one for this instance.
#WGER_SETTINGS['TWITTER'] = ''
diff --git a/wger/settings_global.py b/wger/settings_global.py
index c675d53b6..a1061b74a 100644
--- a/wger/settings_global.py
+++ b/wger/settings_global.py
@@ -175,24 +175,6 @@ EMAIL_SUBJECT_PREFIX = '[wger] '
# EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
-#
-# Django email verification
-#
-
-def email_verified_callback(user):
- user.userprofile.email_verified = True
- user.userprofile.save()
-
-
-EMAIL_VERIFIED_CALLBACK = email_verified_callback
-EMAIL_FROM_ADDRESS = '[email protected]'
-EMAIL_MAIL_SUBJECT = 'Confirm your email'
-EMAIL_MAIL_HTML = 'email_verification/email_body.html'
-EMAIL_MAIL_PLAIN = 'email_verification/email_body.txt'
-EMAIL_TOKEN_LIFE = 60 * 60
-EMAIL_PAGE_TEMPLATE = 'email_verification/confirm_template.html'
-EMAIL_PAGE_DOMAIN = 'https://wger.de/'
-
#
# Login
#
@@ -432,3 +414,21 @@ WGER_SETTINGS = {
'EMAIL_FROM': 'wger Workout Manager <[email protected]>',
'TWITTER': False
}
+
+
+#
+# Django email verification
+#
+def email_verified_callback(user):
+ user.userprofile.email_verified = True
+ user.userprofile.save()
+
+
+EMAIL_VERIFIED_CALLBACK = email_verified_callback
+EMAIL_FROM_ADDRESS = WGER_SETTINGS['EMAIL_FROM']
+EMAIL_MAIL_SUBJECT = 'Confirm your email'
+EMAIL_MAIL_HTML = 'email_verification/email_body.html'
+EMAIL_MAIL_PLAIN = 'email_verification/email_body.txt'
+EMAIL_TOKEN_LIFE = 60 * 60
+EMAIL_PAGE_TEMPLATE = 'email_verification/confirm_template.html'
+EMAIL_PAGE_DOMAIN = 'https://wger.de/'