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_phone(self.phone)
def masking_phone(self): return masking_phone(self.target)
def phones_masking(self): return [masking_phone(phone) for phone in self.phones]