def generate_secrets(self, secondary_secret_p = True): self.primary_secret = utils.random_string(16) if secondary_secret_p: self.secondary_secret = utils.random_string(6, [string.digits]) else: self.secondary_secret = None self.save()
def generate_secrets(self, secondary_secret_p=True): self.primary_secret = utils.random_string(16) if secondary_secret_p: self.secondary_secret = utils.random_string(6, [string.digits]) else: self.secondary_secret = None self.save()
def __init__(self, account_id, username, password, fullname='John Doe', contact_email=None, records=None, primary_secret=utils.random_string(6, [string.digits]), secondary_secret=utils.random_string(6,[string.digits])): self.account_id = account_id self.username= username self.password = password self.fullname = fullname self.contact_email = contact_email if contact_email else self.account_id self.records = records if records else [fullname] self.primary_secret = primary_secret self.secodary_secret = secondary_secret
def _setupargs(self, account_id, username, password, fullname='John Doe', contact_email=None, records=None, primary_secret=utils.random_string(6, [string.digits]), secondary_secret=utils.random_string(6,[string.digits])): self.email = account_id self._username= username self._password = password self.full_name = fullname self.contact_email = contact_email self.records = records self.primary_secret = primary_secret self.secondary_secret = secondary_secret
def password_set(self, new_password): # generate a new salt self.password_salt = utils.random_string(20) # compute the hash self.password_hash = self.compute_hash(new_password, self.password_salt) if self.state == UNINITIALIZED: self.set_state(ACTIVE)
def _setupargs(self, account_id, username, password, fullname='John Doe', contact_email=None, records=None, primary_secret=utils.random_string(6, [string.digits]), secondary_secret=utils.random_string(6, [string.digits])): self.email = account_id self._username = username self._password = password self.full_name = fullname self.contact_email = contact_email self.records = records self.primary_secret = primary_secret self.secondary_secret = secondary_secret
def password_set(self, new_password): # generate a new salt self.password_salt = utils.random_string(20) # compute the hash self.password_hash = self.compute_hash(new_password, self.password_salt) if self.state == UNINITIALIZED: self.set_state(ACTIVE)