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()
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
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
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
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
def pre_create(self): base.Base.pre_create(self) self.client_id = appier.gen_token(hash=hashlib.md5) self.client_secret = appier.gen_token()
def pre_create(self): base.Base.pre_create(self) self.client_id = appier.gen_token(hash = hashlib.md5) self.client_secret = appier.gen_token()
def set_access_token_s(self): self.access_token = appier.gen_token() self.access_token_date = time.time() self.save()
def set_code_s(self): self.authorization_code = appier.gen_token() self.authorization_code_date = time.time() self.save()