def send_phone_verify_code(phoneclaim): msg = SMSMessage( phone_number=phoneclaim.phone, message=current_app.config['SMS_VERIFICATION_TEMPLATE'].format( code=phoneclaim.verification_code)) # Now send this send_message(msg) db.session.add(msg)
def send_phone_verify_code(phoneclaim): msg = SMSMessage( phone_number=phoneclaim.phone, message= "Verification code: %s. If you did not request this, please report to us at %s." % (phoneclaim.verification_code, current_app.config['SITE_SUPPORT_EMAIL'])) # Now send this send_message(msg) db.session.add(msg)
def make_fixtures(self): """ Create users, attach them to organizations. Create test client app, add test resource, action and message. """ crusoe = User(username="******", fullname="Crusoe Celebrity Dachshund") oakley = User(username="******") piglet = User(username="******") nameless = User(fullname="Nameless") db.session.add_all([crusoe, oakley, piglet, nameless]) self.crusoe = crusoe self.oakley = oakley self.piglet = piglet self.nameless = nameless crusoe_email = UserEmail( email="*****@*****.**", user=crusoe, primary=True ) crusoe_phone = UserPhone(phone="+8080808080", user=crusoe, primary=True) oakley_email = UserEmail(email="*****@*****.**", user=oakley) db.session.add_all([crusoe_email, crusoe_phone, oakley_email]) self.crusoe_email = crusoe_email self.crusoe_phone = crusoe_phone batdog = Organization(name='batdog', title='Batdog') batdog.owners.users.append(crusoe) db.session.add(batdog) self.batdog = batdog specialdachs = Organization(name="specialdachs", title="Special Dachshunds") specialdachs.owners.users.append(oakley) db.session.add(specialdachs) self.specialdachs = specialdachs auth_client = AuthClient( title="Batdog Adventures", organization=batdog, confidential=True, namespace='fun.batdogadventures.com', website="http://batdogadventures.com", ) db.session.add(auth_client) self.auth_client = auth_client dachshunds = Team(title="Dachshunds", organization=batdog) db.session.add(dachshunds) self.dachshunds = dachshunds auth_client_team_permissions = AuthClientTeamPermissions( team=dachshunds, auth_client=auth_client, access_permissions="admin" ) self.auth_client_team_permissions = auth_client_team_permissions db.session.add(auth_client_team_permissions) auth_client_user_permissions = AuthClientUserPermissions( user=crusoe, auth_client=auth_client ) db.session.add(auth_client_user_permissions) self.auth_client_user_permissions = auth_client_user_permissions message = SMSMessage( phone_number=crusoe_phone.phone, transactionid="Ruff" * 5, message="Wuff Wuff", ) db.session.add(message) db.session.commit() self.message = message
def make_fixtures(self): """ Create users, attach them to organizations. Create test client app, add test resource, action and message. """ crusoe = User(username=u"crusoe", fullname=u"Crusoe Celebrity Dachshund") oakley = User(username=u"oakley") piglet = User(username=u"piglet") nameless = User(fullname="Nameless") db.session.add_all([crusoe, oakley, piglet, nameless]) self.crusoe = crusoe self.oakley = oakley self.piglet = piglet self.nameless = nameless crusoe_email = UserEmail(email=u"*****@*****.**", primary=True, user=crusoe) crusoe_phone = UserPhone(phone=u"+8080808080", primary=True, user=crusoe) oakley_email = UserEmail(email=u"*****@*****.**", user=oakley) db.session.add_all([crusoe_email, crusoe_phone, oakley_email]) self.crusoe_email = crusoe_email self.crusoe_phone = crusoe_phone batdog = Organization(name=u'batdog', title=u'Batdog') batdog.owners.users.append(crusoe) batdog.members.users.append(oakley) db.session.add(batdog) self.batdog = batdog specialdachs = Organization(name=u"specialdachs", title=u"Special Dachshunds") specialdachs.owners.users.append(oakley) specialdachs.members.users.append(piglet) db.session.add(specialdachs) self.specialdachs = specialdachs client = Client(title=u"Batdog Adventures", org=batdog, confidential=True, namespace=u'fun.batdogadventures.com', website=u"http://batdogadventures.com") db.session.add(client) self.client = client dachshunds = Team(title=u"Dachshunds", org=batdog) db.session.add(dachshunds) self.dachshunds = dachshunds team_client_permission = TeamClientPermissions( team=dachshunds, client=client, access_permissions=u"admin") self.team_client_permission = team_client_permission db.session.add(team_client_permission) client_team_access = ClientTeamAccess( org=batdog, client=client, access_level=CLIENT_TEAM_ACCESS.ALL) db.session.add(client_team_access) bdfl = Permission(name=u"bdfl", title=u"BDFL", user=crusoe) db.session.add(bdfl) self.bdfl = bdfl user_client_permissions = UserClientPermissions(user=crusoe, client=client) db.session.add(user_client_permissions) self.user_client_permissions = user_client_permissions resource = Resource(name=u"test_resource", title=u"Test Resource", client=client) db.session.add(resource) self.resource = resource resource_action = ResourceAction(name=u'Fun', resource=resource, title=u'fun') db.session.add(resource_action) self.resource_action = resource_action action = ResourceAction(name=u"read", title=u"Read", resource=resource) db.session.add(action) self.action = action message = SMSMessage(phone_number=crusoe_phone.phone, transaction_id=u"Ruff" * 5, message=u"Wuff Wuff") db.session.add(message) db.session.commit() self.message = message