Exemplo n.º 1
0
 def post(self):
   """ will handle change of password request, will return success/fail """
   current_session = Session().get_current_session(self)
   email = current_session.get_email()
   
   old_password = self.request.get("oldpassword")
   new_password = self.request.get("newpassword")
   new_password_again = self.request.get("newpasswordagain")
   
   error_message = ""
   success = False
   if new_password != new_password_again:
     error_message = "Passwords do not match."
   else:
     """ Make sure that the account authenticates... this is a redundant check """
     if accounts_dao.authenticate_web_account(email, old_password):
       changed = accounts_dao.change_account_password(email, new_password)
       if changed:
         success = True
     else:
       error_message = "Old password incorrect."
 
   template_values = {"preferences_main" : True,
                      "password_change_attempted" : True,
                      'account_name' : email,
                      "error_message": error_message,
                      "password_changed" : success}
   self.response.out.write(template.render(constants.TEMPLATE_PATHS.CONSOLE_DASHBOARD, template_values))
Exemplo n.º 2
0
 def post(self):
   encodeduser = self.request.get('email')
   encodedpass = self.request.get('password')
   
   username = base64.decodestring(encodeduser)
   password = base64.decodestring(encodedpass)
   
   entity = accounts_dao.authenticate_web_account(username, password)
   if not entity:
     self.error(400)
     return
   
   ''' retrieve all usage information summary (just API calls) '''
   
   q = APICountBatch.all().filter("account_key =", entity.key().name())
   values = {"success": "true"}
   res = q.fetch(1000) 
   values['total'] = q.count() or 1
   values['entry'] = []
   for ii in res:
     ent = {'date':ii.date.strftime("%Y-%m-%d"),
            'count':str(ii.counter)}
     values['entry'].append(ent)
   else:
     ent = {'date':datetime.datetime.now().strftime("%Y-%m-%d"),
            'count':"0"}
     values['entry'].append(ent)
   
   self.response.out.write(simplejson.dumps(values))
Exemplo n.º 3
0
 def post(self):
   username = self.request.get('email')
   password = self.request.get('password')
   
   logging.info("Authentication attempt from: " + username)
   
   entity = accounts_dao.authenticate_web_account(username, password)
   if not entity:
     self.error(400)
Exemplo n.º 4
0
 def post(self):
   username = self.request.get('email')
   password = self.request.get('password')
   
   logging.info("Authentication attempt from: " + username)
   
   entity = accounts_dao.authenticate_web_account(username, password)
   if not entity:
     self.error(400)
Exemplo n.º 5
0
 def post(self):
   encodeduser = self.request.get('email')
   encodedpass = self.request.get('password')
   
   username = base64.decodestring(encodeduser)
   password = base64.decodestring(encodedpass)
   
   entity = accounts_dao.authenticate_web_account(username, password)
   if not entity:
     self.error(400)
Exemplo n.º 6
0
 def post(self):
   """Get the username and password, hash password. Authenticate, make sure account is enabled then redirect to account page. """
   email = self.request.get("email")
   password = self.request.get("password")
   
   logging.info("Attempted log in attempt, email: " + email)
   
   template_values = {'error': "error"}
   if email != None and email != "" and password != None and password != "":
     entity = accounts_dao.authenticate_web_account(email, password)
     if entity:
       update_account.update_account(entity.key().name())
       Session().create_session(self, email, str(uuid.uuid4()), str(time.time() + WEB_ADMIN_PARAMS.VALID_FOR_SECONDS))
       self.redirect("/adminconsole")
     else:
       self.response.out.write(template.render(TEMPLATE_PATHS.CONSOLE_LOGIN, template_values))
   else:
     self.response.out.write(template.render(TEMPLATE_PATHS.CONSOLE_LOGIN, template_values))
Exemplo n.º 7
0
 def post(self):
   """Get the username and password, hash password. Authenticate, make sure account is enabled then redirect to account page. """
   email = self.request.get("email")
   password = self.request.get("password")
   
   logging.info("Attempted log in attempt, email: " + email)
   
   template_values = {'error': "error"}
   if email != None and email != "" and password != None and password != "":
     entity = accounts_dao.authenticate_web_account(email, password)
     if entity:
       update_account.update_account(entity.key().name())
       Session().create_session(self, email, str(uuid.uuid4()), str(time.time() + WEB_ADMIN_PARAMS.VALID_FOR_SECONDS))
       self.redirect("/adminconsole")
     else:
       self.response.out.write(template.render(TEMPLATE_PATHS.CONSOLE_LOGIN, template_values))
   else:
     self.response.out.write(template.render(TEMPLATE_PATHS.CONSOLE_LOGIN, template_values))