Exemplo n.º 1
0
 def _verify_pair(self, token, uid):
     """Actually does the verifying to make sure the token is correct
     """
     from main.utils import hash_ten
     calc_token = hash_ten(uid)
     
     if not token == calc_token:
         raise InvalidToken
Exemplo n.º 2
0
    def _verify_pair(self, token, uid):
        """Actually does the verifying to make sure the token is correct
        """
        from main.utils import hash_ten
        calc_token = hash_ten(uid)

        if not token == calc_token:
            raise InvalidToken
Exemplo n.º 3
0
    def calc_secret_key(self):
        """
        calculate a secret key for use in facebook and twitter apps
        this key only needs to be calculated once per user account
        """

        from django.conf import settings
        from main.utils import hash_ten

        s = "%s%s%s" % (self.user.id, self.user.date_joined,
                        settings.SECRET_KEY)

        return hash_ten(s, length=8)
Exemplo n.º 4
0
 def calc_secret_key(self):
     """
     calculate a secret key for use in facebook and twitter apps
     this key only needs to be calculated once per user account
     """
     
     from django.conf import settings
     from main.utils import hash_ten
     
     s = "%s%s%s" % (self.user.id,
                     self.user.date_joined,
                     settings.SECRET_KEY)
           
     return hash_ten(s, length=8)
Exemplo n.º 5
0
def change_email(request):
    u = request.GET.get('u')
    t = request.GET.get('t')

    from main.utils import hash_ten
    if not (u and t) or not (hash_ten(u) == t):
        raise Http404

    from django.contrib.auth.models import User
    user = User.objects.get(pk=u)

    p = user.get_profile()

    from profile.forms import ProfileForm
    form = ProfileForm(instance=p)

    return locals()
Exemplo n.º 6
0
def change_email(request):
    u = request.GET.get('u')
    t = request.GET.get('t')
    
    from main.utils import hash_ten
    if not (u and t) or not (hash_ten(u) == t):
        raise Http404
    
    from django.contrib.auth.models import User
    user = User.objects.get(pk=u)

    p = user.get_profile()
    
    from profile.forms import ProfileForm
    form = ProfileForm(instance=p)
           
    
    return locals()
Exemplo n.º 7
0
 def make_unsubscrbe_link(self):        
     token = hash_ten(self.user.id)
     url = "http://flightlogg.in/change_email.html?u=%s&t=%s"
     
     return url % (self.user.id, token)
Exemplo n.º 8
0
    def make_unsubscrbe_link(self):
        token = hash_ten(self.user.id)
        url = "http://flightlogg.in/change_email.html?u=%s&t=%s"

        return url % (self.user.id, token)