Ejemplo n.º 1
0
    def pre_create(self):
        base.Base.pre_create(self)

        cls = self.__class__
        duration = appier.conf("OAUTH_DURATION", cls.DEFAULT_DURATION, cast = int)
        self.access_token = appier.gen_token()
        self.access_token_date = time.time()
        self.client_secret = appier.gen_token()
        self.authorization_code = appier.gen_token()
        self.authorization_code_date = time.time()
        self.expires_in = duration
        self.refresh_token = appier.gen_token()
        self.tokens = self._filter_scope(self.scope)
        self.name = self.access_token[:8]

        self._verify()
Ejemplo n.º 2
0
 def create_s(cls, username, email, password="", send_email=False):
     if not password: password = appier.gen_token(limit=16)
     account = cls(username=username,
                   email=email,
                   password=password,
                   password_confirm=password)
     account.save()
     if send_email: account.email_new(password=password)
     return account
Ejemplo n.º 3
0
 def _gen_token(self, scope=None):
     csfr_m = self.session.get("csfr", {})
     tokens, tokens_l = csfr_m.get(scope, ({}, []))
     self._force_limit(tokens, tokens_l)
     token = appier.gen_token(hash=hashlib.md5)
     tokens[token] = True
     tokens_l.append(token)
     csfr_m[scope] = (tokens, tokens_l)
     self.session["csfr"] = csfr_m
     return token
Ejemplo n.º 4
0
 def _gen_token(self, scope = None):
     csfr_m = self.session.get("csfr", {})
     tokens, tokens_l = csfr_m.get(scope, ({}, []))
     self._force_limit(tokens, tokens_l)
     token = appier.gen_token(hash = hashlib.md5)
     tokens[token] = True
     tokens_l.append(token)
     csfr_m[scope] = (tokens, tokens_l)
     self.session["csfr"] = csfr_m
     return token
Ejemplo n.º 5
0
 def create_s(cls, username, email, password = "", send_email = False):
     if not password: password = appier.gen_token(limit = 16)
     account = cls(
         username = username,
         email = email,
         password = password,
         password_confirm = password
     )
     account.save()
     if send_email: account.email_new(password = password)
     return account
Ejemplo n.º 6
0
    def pre_create(self):
        base.Base.pre_create(self)

        self.client_id = appier.gen_token(hash=hashlib.md5)
        self.client_secret = appier.gen_token()
Ejemplo n.º 7
0
    def pre_create(self):
        base.Base.pre_create(self)

        self.client_id = appier.gen_token(hash = hashlib.md5)
        self.client_secret = appier.gen_token()
Ejemplo n.º 8
0
 def set_access_token_s(self):
     self.access_token = appier.gen_token()
     self.access_token_date = time.time()
     self.save()
Ejemplo n.º 9
0
 def set_code_s(self):
     self.authorization_code = appier.gen_token()
     self.authorization_code_date = time.time()
     self.save()
Ejemplo n.º 10
0
 def set_access_token_s(self):
     self.access_token = appier.gen_token()
     self.access_token_date = time.time()
     self.save()
Ejemplo n.º 11
0
 def set_code_s(self):
     self.authorization_code = appier.gen_token()
     self.authorization_code_date = time.time()
     self.save()