@param CreateUser $request

@return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
324320
public function store(CreateUser $request)
    {
        $request->merge(['password' => bcrypt($request->get('password'))]);

        try {
            $user = UserProxy::create($request->except('roles'));
            $user->syncRoles($request->roles());

            flash()->success(__('User has been created'));
        } catch (\Exception $e) {
            flash()->error(__('Error: :msg', ['msg' => $e->getMessage()]));
            return redirect()->back();
        }

        //@todo process route prefixes based on box config
        return redirect(route('appshell.user.index'));
    }
1115865
public function newAction(Request $request)
    {
        $redirection = new Redirection();

        $form = $this->getRedirectionForm($redirection, '#new-redirection-form-container');
        $form->handleRequest($request);

        if ($request->query->get('novalidate', false) === false) {
            if ($form->isValid()) {
                if ($redirection->getLink()->getLinkType() !== Link::TYPE_NONE) {
                    $em = $this->getDoctrine()->getManager();
                    $em->persist($redirection);
                    $em->flush();

                    $this->congrat($this->get('translator')->trans('victoire.redirection.create.success'));

                    return new Response($this->renderView('@VictoireSeo/Redirection/_newForm.html.twig', [
                        'isOpened'  => true,
                        'form'      => $this->getRedirectionForm(new Redirection(), '#new-redirection-form-container')->createView(),
                        'icTrigger' => [
                            'target' => '#redirections-list-container',
                            'url'    => $this->generateUrl('victoire_redirection_showListItem', [
                                'id' => $redirection->getId(),
                            ]),
                        ],
                    ]), 200, [
                        'X-Inject-Alertify' => true,
                    ]);
                } else {
                    // force form error when no link submitted
                    $form->addError(new FormError('This value should not be blank.'));
                }
            } else {
                $this->warn($this->get('translator')->trans('victoire.404.form.error.unvalid'));
            }

            return new Response($this->renderView('@VictoireSeo/Redirection/_newForm.html.twig', [
                'form'     => $form->createView(),
                'isOpened' => true,
            ]), 200, [
                'X-Inject-Alertify' => true,
            ]);
        }

        // rebuild form to avoid wrong form error
        $form = $this->getRedirectionForm($redirection, '#new-redirection-form-container');

        return new JsonResponse([
            'html' => $this->renderView('@VictoireSeo/Redirection/_newForm.html.twig', [
                'form'      => $form->createView(),
                'isOpened'  => true,
            ]),
        ]);
    }
430832
public function postAccept(CreateUserWithTokenRequest $request)
    {
        if (! $request->has('token')) abort(403);
        if (! $invitation = $this->validateToken($request->input('token'))) abort(403);

        $user = User::create([
            'name' => $request->input('name'),
            'email' => $request->input('email'),
            'password' => bcrypt($request->input('password')),
        ]);

        event(new UserCreated($user));

        $invitation = UserInvitation::where('token', $request->input('token'))->first();
        $invitation->user()->associate($user);
        $invitation->accept();

        return Response::json(['created' => true ]);
    }
458717
public function update(UpdateUserRequest $request, User $user)
    {
        $this->authorize(UsersPolicy::PERMISSION_UPDATE);

        $user->update($request->getValidatedData());
        $user->roles()->sync($request->get('roles'));

        $this->transNotification('updated', ['name' => $user->full_name], $user->toArray());

        return redirect()->route('admin::auth.users.show', [$user->hashed_id]);
    }
844988
public function createAction(Request $request)
    {
        $template = new Template();

        $form = $this->createForm(TemplateType::class, $template);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();

            $em->persist($template);
            $em->flush();

            return $this->redirectToRoute('opifer_cms_template_edit', ['id' => $template->getId()]);
        }

        return $this->render('OpiferCmsBundle:Backend/Template:create.html.twig', [
            'form' => $form->createView(),
        ]);
    }
658230
public function newAction(Request $request)
    {
        $userManager = $this->get('fos_user.user_manager');

        /** @var User $user */
        $user = $userManager->createUser();

        $form = $this->createForm(UserType::class, $user, ['new' => true]);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $user->setEnabled(true);
            $user->setPlainPassword($form->get('password')->getData());

            $userManager->updateUser($user);

            $this->addFlash('success', 'New user successfully created!');

            return $this->redirectToRoute('campaignchain_core_user');
        }

        return $this->render('CampaignChainCoreBundle:User:new.html.twig',
            array(
                'form' => $form->createView(),
                'page_title' => 'Create New User',
            ));
    }
726318
public static function create_from_request($request) {
        if($type = $request->getVar('accept')) {
            try {
                if(array_key_exists($type, self::$lookup)) {
                    return self::create(self::$lookup[$type]);
                }
            } catch(\Exception $e) {}
        }
        $types = $request->getAcceptMimetypes();
        foreach($types as $type) {
            try {
                return self::create($type);
            } catch(RestUserException $e) {}
        }
        return self::create();
    }
823912
public function createAction(Request $request)
        {
            $oUser = new User();
            $form = $this->createCreateForm($oUser);
            $form->handleRequest($request);

            if ($form->isValid()) {

                $factory  = $this->get('security.encoder_factory');
                $encoder  = $factory->getEncoder($oUser);
                $password = $encoder->encodePassword($oUser->getPassword(), $oUser->getSalt());
                $oUser->setPassword($password);
                $oUser->save();

                return $this->redirect($this->generateUrl('backend_system_user'));
            }

            return $this->render('SlashworksBackendBundle:User:new.html.twig', array(
                'entity' => $oUser,
                'form'   => $form->createView(),
            ));
        }
650051
public function postLogin (Request $request, \Neuron\Interfaces\Models\User $user, $registered = false)
    {
        $parameters = array();
        if ($registered) {
            $parameters['registered'] = 1;
        }

        // Also set in session... why wouldn't this be in session? :D
        $request->getSession()->set('userJustRegistered', $registered);

        $this->trigger('user:login', [
            'request' => $request,
            'user' => $user,
            'registered' => $registered
        ]);

        // Should skip welcome screen?
        if ($request->getSession()->get('skip-welcome-redirect')) {
            $redirectUrl = $this->getAndClearPostLoginRedirect($request);
            return Response::redirect($redirectUrl);
        }

        return $this->redirectToWelcome ([]);
    }
441104
public function post(Request $request)
    {
        $userData = $this->getContentAsArray($request);

        $errors = $this->userRegistrationValidator->validate($userData ?: []);

        if (count($errors) > 0) {
            return $this->createConstraintViolationResponse($errors);
        }

        try {
            $newUser = $this->userService->register($userData);
        } catch (OutOfBoundsException $e) {
            return $this->createEmailNotUniqueResponse();
        }

        $newUser = $this->userArrayWithoutPassword($newUser);

        $newUser['_href'] = $this->url('user-entity', array('user' => $newUser['id']));

        return $this->createJsonResponse($newUser, 201);
    }
451944
public function createAction(Request $request)
    {
        $filterId = $request->get('filter');
        $handler = $request->get('handler');

        $subscriptionManager = $this->get('phlexible_message.subscription_manager');
        $filterManager = $this->get('phlexible_message.filter_manager');

        $filter = $filterManager->find($filterId);

        $subscription = $subscriptionManager->create()
            ->setUserId($this->getUser()->getId())
            ->setFilter($filter)
            ->setHandler($handler);

        $subscriptionManager->updateSubscription($subscription);

        return new ResultResponse(true, 'Subscription created.');
    }
329949
public function update(UpdateUserRequest $request)
    {
        $this->dispatch(new UpdateUser($this->auth->user()->id, $request->get('name'), $request->get('email')));
        return redirect()->route('authentication::profile.show');
    }
1353183
public function store(CreateCustomer $request)
    {
        try {
            $customer = CustomerProxy::create($request->all());

            flash()->success(__(':name has been created', ['name' => $customer->getName()]));
        } catch (\Exception $e) {
            flash()->error(__('Error: :msg', ['msg' => $e->getMessage()]));

            return redirect()->back()->withInput();
        }

        return redirect(route('appshell.customer.index'));
    }
319929
public function create(Request $request)
    {
        if (!$this->can('create-' . Str::plural($this->slug), auth()->user()->id)) {
            abort(404);
        }

        return view('laramin::models.add-edit')
            ->withStatus('Add')
            ->withColumns($this->columns())
            ->withType($this->type);
    }
1302840
public function createAction(Request $request)
    {
        $form = $this->container->get('form.factory')->createNamed(
            'page',
            CreationType::class,
            null,
            array(
                'action' => $this->container->get('router')->generate('synapse_admin_page_creation'),
                'method' => 'POST',
                'csrf_protection' => false,
            )
        );

        if ($request->request->has('page')) {
            $form->handleRequest($request);
            if ($form->isValid()) {
                $page = $form->getData()->resolve();

                return $this->redirect(
                    $this->container->get('router')->generate('synapse_admin_page_edition', array(
                        'id' => $page->getId(),
                    ))
                );
            }
        }

        return $this->render('SynapsePageBundle:Admin/Page:create.html.twig', array(
            'form' => $form->createView(),
        ));
    }
537635
public function createAction(Request $request)
    {
        $user = $this->getParameter('opifer_cms.user_model');
        $user = new $user();

        $form = $this->createForm(UserFormType::class, $user);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $this->get('fos_user.user_manager')->updateUser($user, true);

            $this->addFlash('success', $this->get('translator')->trans('user.new.success', [
                '%username%' => ucfirst($user->getUsername()),
                '%id%' => $user->getId(),
            ]));

            return $this->redirectToRoute('opifer_cms_user_index');
        }

        return $this->render('OpiferCmsBundle:Backend/User:create.html.twig', [
            'form' => $form->createView(),
        ]);
    }
4268
public function newAction(Request $request)
    {
        $this->denyAccessUnlessGranted(ContributionActionInterface::CREATE, UserInterface::ENTITY_TYPE);

        $userClass = $this->container->getParameter('open_orchestra_user.document.user.class');
        /** @var UserInterface $user */
        $user = new $userClass();
        $user->setEmail($request->get('email'));
        $user->setLastName($request->get('lastName'));
        $user->setFirstName($request->get('firstName'));

        $form = $this->createForm('oo_registration_user', $user, array(
                'action' => $this->generateUrl('open_orchestra_user_admin_new'),
                'required_password' => true,
                'validation_groups' => array('Registration'),
            )
        );

        $form->handleRequest($request);

        if ($form->isValid()) {
            $documentManager = $this->get('object_manager');
            $documentManager->persist($user);
            $documentManager->flush();
            $message = $this->get('translator')->trans('open_orchestra_user_admin.new.success');

            $this->dispatchEvent(UserEvents::USER_CREATE, new UserEvent($user));
            $response = new Response(
                $message,
                Response::HTTP_CREATED,
                array('Content-type' => 'text/plain; charset=utf-8', 'userId' => $user->getId())
            );

            return $response;
        }

        return $this->renderAdminForm($form);
    }