handle a post to the login or install form
351312
public function postIndex(Request $request) {
		//regular login
		if (DB::table(config('center.db.users'))->count()) {
			//attempt auth
			if (Auth::attempt(['email'=>$request->input('email'), 'password'=>$request->input('password')], true)) {

				DB::table(config('center.db.users'))->where('id', Auth::user()->id)->update([
					'last_login'=>new DateTime
				]);
												
				return redirect()->intended(action('\LeftRight\Center\Controllers\TableController@index'));
				
			}
			return redirect()->action('\LeftRight\Center\Controllers\TableController@index')->with('error', trans('center::site.login_invalid'));
		} 
		
		//installing, make user
		$user_id = DB::table(config('center.db.users'))->insertGetId([
			'name'			=> $request->input('name'),
			'email'			=> $request->input('email'),
			'password'		=> Hash::make($request->input('password')),
			'last_login'	=> new DateTime,
			'updated_at'	=> new DateTime,
			'updated_by'	=> 1,
		]);
				
		Auth::loginUsingId($user_id, true);

		return redirect()->action('\LeftRight\Center\Controllers\TableController@index');
	}
528333
function PostInstall() {

    var self = this;

    //Initialize post installation scripts.
    var init = function() {
        self.isWin32 = ( os.platform() == 'win32' ) ? true : false;
        self.path = _( __dirname.substring(0, (__dirname.length - "script".length)-1 ) );
        self.root = process.cwd().toString();


        createVersionFile();
        //console.log('[ debug ] createVersionFile()');
        createGinaFileForPlatform();
        //console.log('[ debug ] createGinaFileForPlatform()');
    }

    var createVersionFile = function(callback) {
        var version = require( _(self.path + '/package.json') ).version;
        var target = _(self.path + '/VERSION');
        try {
            if ( fs.existsSync(target) ) {
                fs.unlinkSync(target);
                setTimeout(function(){
                    if (callback) {



                            fs.writeFileSync(target, version);
                            callback()

                    } else {
                        fs.writeFileSync(target, version);
                    }
                }, 1000)

            } else {
                fs.writeFileSync(target, version);
            }

        } catch(err) {
            throw err;
            process.exit(0)
        }
    }

    //Creating framework command line file for nix.
    var createGinaFile = function(win32Name, callback) {
        var name = require( _(self.path + '/package.json') ).name;
        var appPath = _( self.path.substring(0, (self.path.length - ("node_modules/" + name + '/').length)) );
        var source = _(self.path + '/core/template/command/gina.tpl');
        var target = _(appPath +'/'+ name);
        if ( typeof(win32Name) != 'undefined') {
            target = _(appPath +'/'+ win32Name)
        }

        //Will override.
        if ( typeof(callback) != 'undefined') {

            try {
                utils.generator.createFileFromTemplateSync(source, target);
                setTimeout(function () {
                    callback(false)
                }, 1000)
            } catch (err) {
                callback(err)
            }
        } else {
            utils.generator.createFileFromTemplateSync(source, target)
        }
    }

    var createGinaFileForPlatform = function() {
        console.log('creating platform file');
        //console.log('[ debug ] about to open ' + _(self.path + '/package.json'));
        var name = require( _(self.path + '/package.json') ).name;

        var filename = ( (self.isWin32) ? '.' : '' ) + name;

        var keepGoing = function(filename) {



            createGinaFile(filename, function onGinaFileCreated(err){

                if (err) {
                    throw err;
                    return false
                }
                // this is done to allow multiple calls of post_install.js
                var filename = _(self.path + '/SUCCESS');
                var installed = fs.existsSync( filename );
                if (!installed /**&& /node_modules\/gina/.test( new _(process.cwd()).toUnixStyle() ) */ ) {
                    fs.writeFileSync(filename, true )
                }

                // old NPM : < 3 & compatible 3+
                console.log('> now installing dependencies, please wait ...\n\r');
                var dependencies = require( _(self.path + '/package.json') ).ginaDependencies;

                // starting from NodeJS v5.x, it is done automatically
                npmInstall(dependencies);

            });
        }

        if (self.isWin32) {
            var appPath = _( self.path.substring(0, (self.path.length - ("node_modules/" + name + '/').length)) );
            var source = _(self.path + '/core/template/command/gina.bat.tpl');
            var target = _(appPath +'/'+ name + '.bat');
            if ( fs.existsSync(target) ) {
                fs.unlinkSync(target);
                // have to wait for windows to complete this
                setTimeout( function(){
                    utils.generator.createFileFromTemplateSync(source, target);
                    keepGoing(filename)
                }, 1000)
            } else {
                utils.generator.createFileFromTemplateSync(source, target);
                keepGoing(filename)
            }
        } else {
            filename += '.sh';// patch for latest npm release
            keepGoing(filename)
        }
    }


    var npmInstall = function(modules) {
        if ( modules.count() == 0 ) {
            console.log("\nGina's command line tool has been installed !\n");
            process.exit(0)
        }

        var cmd = ( isWin32() ) ? 'npm.cmd install' : 'npm install';
        var key = null;
        for (var m in modules) {
            key = m;
            if ( modules[m] != '') {
                cmd += ' '+ m +'@'+ modules[m];
                console.log('installing [ '+ m +'@'+ modules[m] +' ]');
            } else {
                cmd += ' '+ m + '@latest';
                console.log('installing [ '+ m + '@latest ]');
            }

            break
        }

        delete modules[key];

        if ( !fs.existsSync(self.path) ) {
            fs.mkdirSync(self.path)
        }

        if ( !fs.existsSync(self.path +'/node_modules') ) {
            fs.mkdirSync(self.path +'/node_modules')
        }

        if ( !fs.existsSync(self.path +'/tmp') ) {
            fs.mkdirSync(self.path +'/tmp')
        }

        //console.debug('cwd: ' + _(self.path));
        //console.debug('tmp: ' +  _(self.root +'/tmp'));

        run(cmd, { cwd: _(self.path), tmp: _(self.root +'/tmp')  })
            .onData(function(data){
                //console.info(data)
            })
            .onComplete( function done(err, data){
                if (err && err != 'false') {
                    console.error(err);
                    //console.debug('\nCommand was: \n'+ cmd)
                } //else {
                    //console.info(data);
                    //end()
                //}

                npmInstall(modules)
            })
    }

    var end = function() {
        // Update middleware file
        var filename = _(self.path) + '/MIDDLEWARE';
        var msg = "Gina's command line tool has been installed.\n\r";

        var deps = require(_(self.path) + '/package.json').dependecies;


        for (var d in deps) {
            if (d === 'express' && deps[d] != '') {
                var middleware = d +'@'+ deps[d]
            }
        }

        var expressPackage = _(self.path + '/node_modules/express/package.json');
        if ( typeof(middleware) == 'undefined' && fs.existsSync(expressPackage) ) {
            var middleware = require(expressPackage).version;
            middleware = 'express@' + middleware;
        } else if (typeof(middleware) == 'undefined') {
            throw new Error('No middleware found !!');
            process.exit(0)
        }

        if ( fs.existsSync(filename) ) { // update
            var def = fs.readFileSync(filename).toString;
            // TODO - uninstall old if installed ??
            if (def !== middleware) {

                try {

                    fs.writeFileSync(filename, middleware);
                    console.log(msg)
                } catch (err) {
                    throw new Error(err.stack||err.message||err);
                    process.exit(0)
                }

                // fs.writeFile(filename, middleware, function onWrote(err){
                //     if (err) {
                //         throw new Error(err.stack||err.message||err);
                //         process.exit(1)
                //     } else {
                //         console.log(msg)
                //     }
                // })
            } // else, nothing to do
        } else { // create

            try {

                fs.writeFileSync(filename, middleware);
                console.log(msg)
            } catch (err) {
                throw new Error(err.stack||err.message||err);
                process.exit(0)
            }

            // fs.writeFile(filename, middleware, function onWrote(err){
            //     if (err) {
            //         throw new Error(err.stack||err.message||err);
            //         process.exit(1)
            //     } else {
            //         console.log(msg)
            //     }
            // })
        }
    }

    //var createGinaHome = function() { };


    init()
}
1091460
public function installAction()
    {
        $form = $this->installForm;
        $form->setData($_POST);

        if (!$form->isValid()) {
            return $this->createJsonResponse(
                array(
                    'ok'     => false,
                    'errors' => $form->getMessages(),
                )
            );
        }

        $data = $form->getData();

        try {
            $options = [
                'connection' => $data['db_conn'],
            ];
            $userOk = $this->plugin('Install/UserCreator', $options)->process($data['username'], $data['password'], $data['email']);
            $ok = $this->plugin('Install/ConfigCreator')->process($data['db_conn'], $data['email']);
        } catch (\Exception $exception) {
            /* @TODO: provide a way to handle global error message */
            return $this->createJsonResponse([
                'ok'        => false,
                'errors'    => [
                    'global' => [$exception->getMessage()]
                ]
            ]);
        }

        /*
         * Make sure there's no cached config files
         */
        $this->cacheService->clearCache();

        $model = $this->createViewModel(array('ok' => $ok), true);
        $model->setTemplate('install/index/install.ajax.phtml');

        return $model;
    }
20740
async def post(self, cmd, data=None, timeout=None, **args):
        """"""
        def _post_request():
            headers = copy(_DMAP_HEADERS)
            headers['Content-Type'] = 'application/x-www-form-urlencoded'
            return self.http.post_data(
                self._mkurl(cmd, *args),
                data=data,
                headers=headers,
                timeout=timeout)

        await self._assure_logged_in()
        return await self._do(_post_request)
16819
function _postHandlers() {
  // any authentication checks first
  if(config.authentication.enabled) {
    logger.info(pkgname + "  authentication to API's enabled");
    app.all(config.api.path, function(req, res, next) {
      if(config.authentication.ignores && req.params) {
        // check if the params is in ignores list
        var matches = _.filter(req.params, function(param) {
          return _.find(config.authentication.ignores, function(ignore) {
            return param.indexOf(ignore)==0;
          });
        });
        if(matches && matches.length>0) {
          logger.debug(pkgname+"ignored auth for param:" + matches);
          return next();
        }
      }
      if(req.loggedIn) {
        return next();  // auth success go to next
      } else {
        return next(error(401, 'unauthorized access'));
      }
    });
  }

  // install api checks
  if(config.api.keycheck) {
    logger.info(pkgname + "  keycheck to API's enabled");
    // here we validate the API key 
    app.all(config.api.path, function(req, res, next){
      var key = req.query[config.api.KEYNAME] || req.body[config.api.KEYNAME];
 
      // key isnt present
      if (!key) return next(error(400, 'api key required'));
 
      // key is invalid
      if (!~config.api.keys.indexOf(key)) return next(error(401, 'invalid api key'));
 
      // all good, store req.key for route access
      req.key = key;
      next();
    });
  }

  // jsonp support for delete, put & post (partial post)
  if(config.server.jsonp) {
    logger.info(pkgname + "  jsonp support on api's enabled");
    // check if callback is there along with method
    app.all(config.api.path, function(req, res, next) {
      if(req.query && req.query['callback'] && req.query['_method']) {
        // lets rewrite the method, especially PUT/DELETE/POST
        req.method=req.query['_method'];
        logger.debug(pkgname + "jsonp request converted:"+req.query);
      }
      next();
    });
  }

  var api = {
    index: function(req,res) {
      res.json({app:config.app.title, version:config.app.version});
    }
  };
  global.apiresource = app.resource('api', api);
  logger.info(pkgname + "  api handler added");
  logger.debug(pkgname + "init complete");
}
50435
def post(self, request, **resources):
        
        if not self._meta.form:
            return None

        form = self._meta.form(request.data, **resources)
        if form.is_valid():
            return form.save()

        raise FormError(form)
757919
def handle_register_or_upload(post_data, files, user, repository):
    
    name = post_data.get('name')
    version = post_data.get('version')

    if settings.LOCALSHOP_VERSIONING_TYPE:
        scheme = get_versio_versioning_scheme(settings.LOCALSHOP_VERSIONING_TYPE)
        try:
            Version(version, scheme=scheme)
        except AttributeError:
            response = HttpResponseBadRequest(
                reason="Invalid version supplied '{!s}' for '{!s}' scheme.".format(
                    version, settings.LOCALSHOP_VERSIONING_TYPE))
            return response

    if not name or not version:
        logger.info("Missing name or version for package")
        return HttpResponseBadRequest('No name or version given')

    try:
        condition = Q()
        for search_name in get_search_names(name):
            condition |= Q(name__iexact=search_name)

        package = repository.packages.get(condition)

        # Error out when we try to override a mirror'ed package for now
        # not sure what the best thing is
        if not package.is_local:
            return HttpResponseBadRequest(
                '%s is a pypi package!' % package.name)

        try:
            release = package.releases.get(version=version)
        except ObjectDoesNotExist:
            release = None
    except ObjectDoesNotExist:
        package = None
        release = None

    # Validate the data
    form = forms.ReleaseForm(post_data, instance=release)
    if not form.is_valid():
        return HttpResponseBadRequest(reason=form.errors.values()[0][0])

    if not package:
        pkg_form = forms.PackageForm(post_data, repository=repository)
        if not pkg_form.is_valid():
            return HttpResponseBadRequest(
                reason=six.next(six.itervalues(pkg_form.errors))[0])
        package = pkg_form.save()

    release = form.save(commit=False)
    release.package = package
    release.save()

    # If this is an upload action then process the uploaded file
    if files:
        files = {
            'distribution': files['content']
        }
        filename = files['distribution']._name
        try:
            release_file = release.files.get(filename=filename)
            if settings.LOCALSHOP_RELEASE_OVERWRITE is False:
                message = 'That it already released, please bump version.'
                return HttpResponseBadRequest(message)
        except ObjectDoesNotExist:
            release_file = models.ReleaseFile(
                release=release, filename=filename)

        form_file = forms.ReleaseFileForm(
            post_data, files, instance=release_file)
        if not form_file.is_valid():
            return HttpResponseBadRequest('ERRORS %s' % form_file.errors)
        release_file = form_file.save(commit=False)
        release_file.save()

    return HttpResponse()
1174309
protected function submitDownload()
    {
        if ($this->isPosted('install') && $this->validateDownload()) {
            $this->controlAccess('module_installer_download');
            $this->install_model->fromUrl($this->getSubmitted('sources'));
        }
    }
1233028
def post(self):
    """"""
    template_values = {
        'back_url': '/showCredentials',
        'back_msg': 'View Credentials',
        'logout_url': users.create_logout_url('/'),
        'user_nickname': users.get_current_user().nickname()
    }
    try:
      UpdateUserCredentials(self.request.get('client_id'),
                            self.request.get('client_secret'),
                            self.request.get('refresh_token'),
                            self.request.get('adwords_manager_cid'),
                            self.request.get('dev_token'))
      self.redirect('/showCredentials')
    except Exception, e:
      template_values['error'] = str(e)
      # Use template to write output to the page.
      path = os.path.join(os.path.dirname(__file__),
                          '../templates/base_template.html')
      self.response.out.write(template.render(path, template_values))
490336
def post(self, request, *args, **kwargs):
        
        return self.update_type(request, *args, **kwargs)
548383
def handle(self, *args, **options):
        """"""
        # TODO: refactor these with .get
        if 'username' in options:
            self.username = options['username']
        else:
            self.username = None
        if 'password' in options:
            self.password = options['password']
        else:
            self.password = None

        self.xml_path = options.get('xml')
        self.url = options.get('url')
        try:
            blog_index = BlogIndexPage.objects.get(
                title__icontains=options['blog_index'])
        except BlogIndexPage.DoesNotExist:
            raise CommandError("Incorrect blog index title - have you created it?")
        if self.url == "just_testing":
            with open('test-data.json') as test_json:
                posts = json.load(test_json)
        elif self.xml_path:
            try:
                import lxml
                from blog.wp_xml_parser import XML_parser
            except ImportError as e:
                print("You must have lxml installed to run xml imports."
                      " Run `pip install lxml`.")
                raise e
            self.xml_parser = XML_parser(self.xml_path)
            posts = self.xml_parser.get_posts_data()
        else:
            posts = self.get_posts_data(self.url)
        self.should_import_comments = options.get('import_comments')
        self.create_blog_pages(posts, blog_index)
293332
def post(self, request, *args, **kwargs):
        """"""
        try:
            kwargs = self.load_object(kwargs)
        except Exception as e:
            return self.render_te_response({
                'title': str(e),
            })

        if not self.has_permission(request):
            return self.render_te_response({
                'title': 'No access',
            })
        return self.render_te_response(self.handle_dialog(*args, **kwargs))
1205686
def do_POST(self):  # pylint: disable=g-bad-name
    """"""
    self._IncrementActiveCount()
    try:
      if self.path.startswith("/upload"):
        stats_collector_instance.Get().IncrementCounter(
            "frontend_http_requests", fields=["upload", "http"])

        logging.error("Requested no longer supported file upload through HTTP.")
        self.Send("File upload though HTTP is no longer supported", status=404)
      else:
        stats_collector_instance.Get().IncrementCounter(
            "frontend_http_requests", fields=["control", "http"])
        self.Control()

    except Exception as e:  # pylint: disable=broad-except
      if flags.FLAGS.pdb_post_mortem:
        pdb.post_mortem()

      logging.exception("Had to respond with status 500.")
      self.Send("Error: %s" % e, status=500)
    finally:
      self._DecrementActiveCount()
1102560
static public function formSubmit() {

		// --------------------------------------------------------------------------------------------------------
		// Sanity check

		if ( false === static::isFormSubmission() || false === current_user_can( 'edit_posts' ) ) {
			// Don't do anything in this function, bail.
			return;
		}

		// --------------------------------------------------------------------------------------------------------
		// Determine at what stage of the import we are and do something about it

		$redirect_url = get_admin_url( get_current_blog_id(), '/tools.php?page=pb_import' );

		// Revoke
		if ( ! empty( $_GET['revoke'] ) && check_admin_referer( 'pb-revoke-import' ) ) {
			self::_revokeCurrentImport();
			\Pressbooks\Redirect\location( $redirect_url );
		}

		if ( isset( $_GET['import'] ) && ! empty( $_POST['import_type'] ) && check_admin_referer( 'pb-import' ) ) {
			self::setImportOptions(); // STEP 1
		}

		// Default, back to form
		\Pressbooks\Redirect\location( $redirect_url );
	}
1040447
def post(self, request, *args, **kwargs):
        
        self.object = self.get_object()
        self.login()
        if self.object.password:
            entry_password = self.request.POST.get('entry_password')
            if entry_password:
                if entry_password == self.object.password:
                    self.request.session[self.session_key %
                                         self.object.pk] = self.object.password
                    return self.get(request, *args, **kwargs)
                else:
                    self.error = True
            return self.password()
        return self.get(request, *args, **kwargs)
1135439
protected function handlePOST()
    {
        $extract = $this->request->getParameterAsBool('extract', false);
        $clean = $this->request->getParameterAsBool('clean', false);
        $checkExist = $this->request->getParameterAsBool('check_exist', false);

        if (empty($this->filePath)) {
            $fileNameHeader = str_to_utf8($this->request->getHeader('X-File-Name'));
            $folderNameHeader = str_to_utf8($this->request->getHeader('X-Folder-Name'));
            $fileUrl = filter_var($this->request->getParameter('url', ''), FILTER_SANITIZE_URL);

            if (!empty($fileNameHeader)) {
                // html5 single posting for file create
                $result = $this->handleFileContent(
                    $this->folderPath,
                    $fileNameHeader,
                    $this->request->getContent(),
                    $this->request->getContentType(),
                    $extract,
                    $clean,
                    $checkExist
                );
            } elseif (!empty($folderNameHeader)) {
                // html5 single posting for folder create
                $fullPathName = $this->folderPath . $folderNameHeader;
                $content = $this->request->getPayloadData();
                $this->driver->createFolder($this->container, $fullPathName, $content);
                $result = ['name' => $folderNameHeader, 'path' => $fullPathName];
            } elseif (!empty($fileUrl)) {
                // upload a file from a url, could be expandable zip
                $tmpName = null;
                $newFileName = $this->request->input('filename', '');
                try {
                    $tmpName = FileUtilities::importUrlFileToTemp($fileUrl);
                    $result = $this->handleFile(
                        $this->folderPath,
                        $newFileName,
                        $tmpName,
                        '',
                        $extract,
                        $clean,
                        $checkExist
                    );
                    @unlink($tmpName);
                } catch (\Exception $ex) {
                    if (!empty($tmpName)) {
                        @unlink($tmpName);
                    }
                    throw $ex;
                }
            } elseif (null !== $uploadedFiles = $this->request->getFile('files')) {
                if (Arr::isAssoc($uploadedFiles)) { //Single file upload
                    $uploadedFiles = [$uploadedFiles];
                }
                $result = $this->handleFolderContentFromFiles($uploadedFiles, $extract, $clean, $checkExist);
                $result = ResourcesWrapper::cleanResources($result);
            } else {
                // possibly xml or json post either of files or folders to create, copy or move
                if (!empty($data = ResourcesWrapper::unwrapResources($this->getPayloadData()))) {
                    $result = $this->handleFolderContentFromData($data, $extract, $clean, $checkExist);
                    $result = ResourcesWrapper::cleanResources($result);
                } else {
                    // create folder from resource path
                    $this->driver->createFolder($this->container, $this->folderPath);
                    $result = ['name' => basename($this->folderPath), 'path' => $this->folderPath];
                }
            }
        } else {
            // create the file
            // possible file handling parameters
            $name = basename($this->filePath);
            $path = (false !== strpos($this->filePath, '/')) ? dirname($this->filePath) : '';
            $files = $this->request->getFile('files');

            if (empty($files)) {
                // direct load from posted data as content
                // or possibly xml or json post of file properties create, copy or move
                $result = $this->handleFileContent(
                    $path,
                    $name,
                    $this->request->getContent(),
                    $this->request->getContentType(),
                    $extract,
                    $clean,
                    $checkExist
                );
            } else {
                if (Arr::isAssoc($files)) { // Single file upload
                    $files = [$files];
                }
                if (1 < count($files)) {
                    throw new BadRequestException("Multiple files uploaded to a single REST resource '$name'.");
                }
                $file = array_get($files, 0);
                if (empty($file)) {
                    throw new BadRequestException("No file uploaded to REST resource '$name'.");
                }
                $error = $file['error'];
                if (UPLOAD_ERR_OK == $error) {
                    $result = $this->handleFile(
                        $path,
                        $name,
                        $file["tmp_name"],
                        $file['type'],
                        $extract,
                        $clean,
                        $checkExist
                    );
                } else {
                    throw new InternalServerErrorException("Failed to upload file $name.\n$error");
                }
            }
        }

        return ResponseFactory::create($result, null, ServiceResponseInterface::HTTP_CREATED);
    }
253188
protected function submitAddPage()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->validateComponent('page');
        $this->addPage();
    }