55from django .contrib .auth .mixins import LoginRequiredMixin
66from django .contrib import auth
77from django .contrib .messages .views import SuccessMessageMixin
8- from django .http import HttpResponseRedirect
8+ from django .http import HttpResponseNotFound , HttpResponseRedirect
99from django .urls import reverse_lazy
1010from django .views .generic import DetailView , FormView
1111from django .views .generic .base import TemplateView
2121from rest_framework import generics
2222from rest_framework import viewsets
2323from rest_framework .permissions import IsAuthenticated , AllowAny
24+ from waffle import flag_is_active
2425
26+ from core .mixins import V3Mixin
2527from libraries .models import CommitAuthorEmail
2628from .forms import (
2729 PreferencesForm ,
@@ -297,12 +299,17 @@ def get_context_data(self, **kwargs):
297299 return context
298300
299301
300- class V3AuthContextMixin :
302+ class V3AuthContextMixin ( V3Mixin ) :
301303 """Shared context for all V3 auth pages (signup, login, password reset, etc.)."""
302304
303- def get_context_data (self , ** kwargs ):
304- context = super ().get_context_data (** kwargs )
305- context ["page_title" ] = "Account"
305+ def dispatch (self , request , * args , ** kwargs ):
306+ if not flag_is_active (request , "v3" ):
307+ return HttpResponseNotFound ()
308+ return super ().dispatch (request , * args , ** kwargs )
309+
310+ def get_v3_context_data (self , ** kwargs ):
311+ context = super ().get_v3_context_data (** kwargs )
312+ context ["page_title" ] = getattr (self , "page_title" , "Account" )
306313 context ["foreground_image_url" ] = (
307314 f"{ settings .STATIC_URL } img/v3/auth-page/auth-page-foreground.png"
308315 )
@@ -318,17 +325,17 @@ def get_context_data(self, **kwargs):
318325
319326
320327class V3SignupView (V3AuthContextMixin , TemplateView ):
321- template_name = "v3/accounts/signup.html"
328+ v3_template_name = "v3/accounts/signup.html"
322329 page_title = "Create An Account"
323330
324- def get_context_data (self , ** kwargs ):
325- context = super ().get_context_data (** kwargs )
331+ def get_v3_context_data (self , ** kwargs ):
332+ context = super ().get_v3_context_data (** kwargs )
326333 context ["password_rules" ] = build_password_rules ()
327334 return context
328335
329336
330337class V3LoginView (V3AuthContextMixin , TemplateView ):
331- template_name = "v3/accounts/login.html"
338+ v3_template_name = "v3/accounts/login.html"
332339 page_title = "Login"
333340
334341
0 commit comments