def post(self): """Process a POST'd command from the sync start page. HACK: This is a little hacky, pivoting on a form field command, but oh well. """ user, profile = Profile.get_user_and_profile() action = self.request.get('action', False) if not profile and 'create_profile' == action: # Create a new profile, with auto-generated password new_profile = Profile(user=user, user_id=user.user_id(), user_name=hashlib.md5( user.user_id()).hexdigest(), password=Profile.generate_password()) new_profile.put() elif profile and 'regenerate_password' == action: # Generate and set a new password for the profile profile.password = Profile.generate_password() profile.put() elif profile and 'delete_profile' == action: # Delete the profile profile.delete() return self.redirect('/start')
def post(self): """Process a POST'd command from the sync start page. HACK: This is a little hacky, pivoting on a form field command, but oh well. """ user, profile = Profile.get_user_and_profile() action = self.request.get('action', False) if not profile and 'create_profile' == action: # Create a new profile, with auto-generated password new_profile = Profile( user = user, user_id = user.user_id(), user_name = hashlib.md5(user.user_id()).hexdigest(), password = Profile.generate_password() ) new_profile.put() elif profile and 'regenerate_password' == action: # Generate and set a new password for the profile profile.password = Profile.generate_password() profile.put() elif profile and 'delete_profile' == action: # Delete the profile profile.delete() return self.redirect('/start')
def get(self): """Display the sync start page""" user, profile = Profile.get_user_and_profile() return self.render_template('main/start.html', { 'user': user, 'profile': profile, 'sync_url': '%s/sync/' % self.request.application_url, 'logout_url': users.create_logout_url(self.request.uri) })
def get(self): """Display the sync start page""" user, profile = Profile.get_user_and_profile() return self.render_template( 'main/start.html', { 'user': user, 'profile': profile, 'sync_url': '%s/sync/' % self.request.application_url, 'logout_url': users.create_logout_url(self.request.uri) })