Browse Source

Fix vpn password gen according to new member class

Fabs 10 years ago
parent
commit
97e923b31c
1 changed files with 5 additions and 5 deletions
  1. 5 5
      coin/vpn/views.py

+ 5 - 5
coin/vpn/views.py

@@ -1,12 +1,12 @@
 import os
 from urllib2 import urlopen
 
-from django.contrib.auth.models import User
 from django.http import StreamingHttpResponse
 from django.shortcuts import render_to_response, get_object_or_404
 from django.views.generic.detail import DetailView
 from django.conf import settings
 
+from coin.members.models import Member
 from coin.vpn.models import VPNConfiguration
 
 
@@ -14,16 +14,16 @@ class VPNView(DetailView):
 
     def get_object(self):
         return get_object_or_404(VPNConfiguration, pk=self.kwargs.get("id"),
-                                 offersubscription__member__user=self.request.user)
+                                 offersubscription__member=self.request.user)
 
 def generate_password(request, id):
     """This generates a random password, saves it in hashed form, and returns
     it to the user in cleartext.
     """
     vpn = get_object_or_404(VPNConfiguration, pk=id,
-                            offersubscription__member__user=request.user)
+                            offersubscription__member=request.user)
     # This function has nothing to here, but it's convenient.
-    password = User.objects.make_random_password()
+    password = Member.objects.make_random_password()
     vpn.password = password
     # This will hash the password automatically
     vpn.full_clean()
@@ -40,7 +40,7 @@ class VPNGeneratePasswordView(VPNView):
     def get_context_data(self, **kwargs):
         context = super(VPNGeneratePasswordView, self).get_context_data(**kwargs)
         # Generate a new random password and save it
-        password = User.objects.make_random_password()
+        password = Member.objects.make_random_password()
         self.object.password = password
         # This will hash the password automatically
         self.object.full_clean()