def send_code(self, request): identity = self.get_identity(request) if identity: missive = use_twofactor(identity) if missive: device = missive.mode target = masking_email( missive.target ) if device == choices.MODE_EMAIL else masking_phone( missive.target) return {'mode': device, 'target': target} return {'error': 'not enable to send a code'}
def masking(self): return masking_email(self.email)
def masking_email(self): return masking_email(self.target)
def emails_masking(self): return [masking_email(email) for email in self.emails]