Self hosted FLOSS fitness/workout, nutrition and weight tracker
remove django-email-verification package code (github issue=2258)
pankaj-basnetd18a20908d1f
diff --git a/.gitignore b/.gitignoreindex 3ec7fe7ad..6004fb395 100644--- a/.gitignore+++ b/.gitignore@@ -89,3 +89,6 @@ venv-wger# macOS.DS_Store++# feature/2258-migrate-to-django-allauth+/z-feature-notes-todos\ No newline at end of filediff --git a/settings/settings_global.py b/settings/settings_global.pyindex 14817caf4..375f895f3 100644--- a/settings/settings_global.py+++ b/settings/settings_global.py@@ -59,7 +59,7 @@ INSTALLED_APPS = ['storages',# Uncomment the next line to enable the admin:- # 'django.contrib.admin',+ 'django.contrib.admin',# Apps from wger proper'wger.config',@@ -109,9 +109,6 @@ INSTALLED_APPS = [# History keeping'simple_history',- # Django email verification- 'django_email_verification',-# Activity stream'actstream',@@ -120,6 +117,9 @@ INSTALLED_APPS = [# Prometheus'django_prometheus',++ 'allauth',+ 'allauth.account',]MIDDLEWARE = [@@ -148,6 +148,9 @@ MIDDLEWARE = ['django.middleware.clickjacking.XFrameOptionsMiddleware','django.middleware.locale.LocaleMiddleware',+ # allauth+ "allauth.account.middleware.AccountMiddleware",+# History keeping'simple_history.middleware.HistoryRequestMiddleware',@@ -163,7 +166,10 @@ AUTHENTICATION_BACKENDS = ('axes.backends.AxesStandaloneBackend', # should be the first one in the list'wger.core.backends.AuthProxyUserBackend','django.contrib.auth.backends.ModelBackend',+ # `allauth` specific authentication methods, such as login by email (Docs)+ 'allauth.account.auth_backends.AuthenticationBackend','wger.utils.helpers.EmailAuthBackend',+)TEMPLATES = [@@ -518,12 +524,12 @@ PROMETHEUS_URL_PATH = 'super-secret-path'## Django email verification#-def email_verified_callback(user):- user.userprofile.email_verified = True- user.userprofile.save()+# def email_verified_callback(user): # TODO: delete this function (((pbc260321)))+# user.userprofile.email_verified = True+# user.userprofile.save()-EMAIL_MAIL_CALLBACK = email_verified_callback+# EMAIL_MAIL_CALLBACK = email_verified_callback # TODO: delete this (((pbc260321)))EMAIL_FROM_ADDRESS = WGER_SETTINGS['EMAIL_FROM']EMAIL_MAIL_SUBJECT = 'Confirm your email'EMAIL_MAIL_HTML = 'email_verification/email_body_html.tpl'diff --git a/wger/config/models/gym_config.py b/wger/config/models/gym_config.pyindex 41623f144..342dd5a9e 100644--- a/wger/config/models/gym_config.py+++ b/wger/config/models/gym_config.py@@ -86,3 +86,6 @@ class GymConfig(models.Model):logger.debug(f'Creating GymUserConfig for user {user.username}')return super(GymConfig, self).save(*args, **kwargs)++# TODO+# D:\src\PY\WGER-2026-PULL-\DJANGO-\CODE-\wger\wger\config\models\gym_config.pydiff --git a/wger/core/api/views.py b/wger/core/api/views.pyindex 197ad4156..cbdea04cb 100644--- a/wger/core/api/views.py+++ b/wger/core/api/views.py@@ -25,7 +25,7 @@ from django.utils.decorators import method_decoratorfrom django.views.decorators.cache import cache_page# Third Party-from django_email_verification import send_email+# from django_email_verification import send_email ## TODO: delete this (((pbc260321)))from drf_spectacular.types import OpenApiTypesfrom drf_spectacular.utils import (OpenApiParameter,@@ -160,7 +160,7 @@ class UserProfileViewSet(viewsets.ModelViewSet):if profile.email_verified:return Response({'status': 'verified', 'message': 'This email is already verified'})- send_email(request.user)+ # send_email(request.user) ## TODO: delete this (((pbc260321)))return Response({'status': 'sent', 'message': f'A verification email was sent to {request.user.email}'})@@ -358,7 +358,7 @@ class UserAPIRegistrationViewSet(viewsets.ViewSet):token = create_token(user)# Email the user with the activation link- send_email(user)+ # send_email(user) ## TODO: delete this (((pbc260321)))return Response({'message': 'api user successfully registered', 'token': token.key},diff --git a/wger/core/models/profile.py b/wger/core/models/profile.pyindex 0428def89..f70fd1142 100644--- a/wger/core/models/profile.py+++ b/wger/core/models/profile.py@@ -558,3 +558,6 @@ by the US Department of Agriculture. It is extremely complete, with aroundReturns the object that has owner information"""return self++# TODO+# D:\src\PY\WGER-2026-PULL-\DJANGO-\CODE-\wger\wger\core\models\profile.py\ No newline at end of filediff --git a/wger/core/views/user.py b/wger/core/views/user.pyindex 3e94a2992..bb3591354 100644--- a/wger/core/views/user.py+++ b/wger/core/views/user.py@@ -74,7 +74,7 @@ from crispy_forms.layout import (Row,Submit,)-from django_email_verification import send_email+# from django_email_verification import send_email # TODO: delete this function (((pbc260321)))from rest_framework.authtoken.models import Token# wger@@ -275,7 +275,7 @@ def registration(request):django_login(request, user)# Email the user with the activation link- send_email(user)+ # send_email(user) # TODO: delete this function (((pbc260321)))# Redirect to the dashboardmessages.success(request, _('You were successfully registered'))@@ -658,7 +658,7 @@ class WgerPasswordResetConfirmView(PasswordResetConfirmView):@login_requireddef confirm_email(request):if not request.user.userprofile.email_verified:- send_email(request.user)+ # send_email(request.user) # TODO: delete this function (((pbc260321)))messages.success(request, _('A verification email was sent to %(email)s') % {'email': request.user.email})diff --git a/wger/tasks.py b/wger/tasks.pyindex 106328927..45b3df3cc 100644--- a/wger/tasks.py+++ b/wger/tasks.py@@ -106,6 +106,14 @@ def create_or_reset_admin(context, settings_path: str = None):User.objects.get(username='admin')print("*** Password for user admin was reset to 'adminadmin'")except User.DoesNotExist:+ # TODO : by pankaj(pbc260321 bpan) , added 7 lines. remove 7 lines later.+ user = User.objects.create_user('username', '[email protected]', 'Cfehome199#')+ user.save()+ user_profile = user.userprofile+ user_profile.is_temporary = True+ user_profile.age = 25+ user_profile.height = 175+ user_profile.save()print('*** Created default admin user')current_dir = os.path.dirname(os.path.abspath(__file__))diff --git a/wger/urls.py b/wger/urls.pyindex fbb9138c3..2cbda8558 100644--- a/wger/urls.py+++ b/wger/urls.py@@ -27,7 +27,7 @@ from django.contrib.sitemaps.views import (from django.urls import path# Third Party-from django_email_verification import urls as email_urls+# from django_email_verification import urls as email_urls ## TODO: delete this (((pbc260321)))from drf_spectacular.views import (SpectacularAPIView,SpectacularRedocView,@@ -358,7 +358,8 @@ urlpatterns += [SpectacularRedocView.as_view(url_name='schema'),name='api-redoc',),- path('email/', include(email_urls)),+ # path('email/', include(email_urls)), ## TODO: delete this (((pbc260321)))+ path('accounts/', include('allauth.account.urls')),]#diff --git a/wger/utils/context_processor.py b/wger/utils/context_processor.pyindex 083017965..544b6d431 100644--- a/wger/utils/context_processor.py+++ b/wger/utils/context_processor.py@@ -103,9 +103,15 @@ def get_custom_header(request):if request.user.is_authenticated and request.user.userprofile.gym:current_gym = request.user.userprofile.gymelse:- global_gymconfig = GymConfig.objects.get(pk=1)- if global_gymconfig.default_gym:- current_gym = global_gymconfig.default_gym+ # TODO: # by pankaj (commented 3 lines , uncomment later . delete lines in this else clause)+ # global_gymconfig = GymConfig.objects.get(pk=1)+ # if global_gymconfig.default_gym:+ # current_gym = global_gymconfig.default_gym+ # Proposed change in wger/utils/context_processor.py+ try:+ global_gymconfig = GymConfig.objects.get(pk=1)+ except GymConfig.DoesNotExist:+ global_gymconfig = None # Or a default fallback object# Put the custom header togethercustom_header = Nonediff --git a/wger/utils/helpers.py b/wger/utils/helpers.pyindex 837ca6787..1567cd864 100644--- a/wger/utils/helpers.py+++ b/wger/utils/helpers.py@@ -36,7 +36,7 @@ from django.shortcuts import get_object_or_404from django.utils.encoding import force_bytesfrom django.utils.http import urlsafe_base64_encode-+# TODO: add log statements here ??logger = logging.getLogger(__name__)