Handle a registration request for the application.

@param  \Illuminate\Http\Request $request

@return \Illuminate\Http\Response
354864
public function postRegister(Request $request)
    {
        $this->validate($request, $this->validateCreating());

        $user = $this->create($request->all());
        if (config('taki.confirm_after_created')) {
            $token              = app('auth.password.tokens')->createNewToken();
            $user->is_activated = 0;
            $user->token        = $token;
            $user->save();
            Mail::queue(config('taki.emails.activate'), compact('token', 'user'), function ($m) use ($user, $token) {
                $m->subject(config('taki.emails.activate_subject'));
                $m->to($user->getEmailForPasswordReset());
            });
        } else {
            Auth::login($user);
        }

        if (method_exists($this, 'userRegistered')) {
            $this->userRegistered($request, $user);
        }


        return redirect($this->getPostRegisterRedirectPath());
    }
324267
public function run(Request $request) {
		$page = $this->getServiceContainer()->getKernel()->getApplication()->getPage();
		$page->setTitle($this->getServiceContainer()->getTranslator()->trans('profile'));

		$payload = new Blank();
		if ($request->isMethod('POST')) {
			$post = $request->request;
			$user = $this->getServiceContainer()->getAuthManager()->getUser();
			$domain = new UserDomain($this->getServiceContainer());
			$serializer = User::getSerializer();

			$fields = $serializer->getFields();
			$fields[] = 'display_name_user_select';
			$attribs = [];

			foreach ($fields as $field) {
				if ($post->has($field)) {
					$attribs[$field] = $post->get($field);
				}
			}

			$payload = $domain->update($user->getId(), ['attributes' => $attribs]);
		}
		return $this->responder->run($request, $payload);
	}
430583
public function handle($request)
    {
        $entity = $this->repository()->findById($request->getId());
        $this->authorize($request, $entity);

        $item = $this->getProperty($entity, $this->field());
        $this->related()->getEntityManager()->remove($item);
        $this->setProperty($entity, $this->field(), null);

        $this->repository()->getEntityManager()->flush();

        return $this->response()->noContent();
    }
1106717
public function registerAction(Request $request)
    {
        if ($this->isGranted(AuthenticatedVoter::IS_AUTHENTICATED_REMEMBERED)) {
            return $this->redirectToRoute($this->getParameter('darvin_user.already_logged_in_redirect_route'));
        }

        $widget = $request->isXmlHttpRequest();

        $form = $this->getSecurityFormFactory()->createRegistrationForm()->handleRequest($request);

        if (!$form->isSubmitted()) {
            return new Response($this->getSecurityFormRenderer()->renderRegistrationForm($widget, $form));
        }

        $successMessage = 'security.action.register.success';

        $needConfirm = $this->getParameter('darvin_user.confirm_registration');
        if (!$this->getSecurityFormHandler()->handleRegistrationForm($form, !$widget, $successMessage, $needConfirm)) {
            $html = $this->getSecurityFormRenderer()->renderRegistrationForm($widget, $form);

            return $widget
                ? new AjaxResponse($html, false, FlashNotifierInterface::MESSAGE_FORM_ERROR)
                : new Response($html);
        }

        $url = $needConfirm ?
            $this->generateUrl('darvin_user_security_confirm_registration') :
            $this->generateUrl($this->getParameter('darvin_user.already_logged_in_redirect_route'))
        ;

        return $widget
            ? new AjaxResponse('', true, $successMessage, [], $url)
            : $this->redirect($url);
    }
580699
public function register(Request $request)
    {

        $request->request->add(
            [
            'password_confirmation' => $request->has('passwordConfirmation') ? $request->passwordConfirmation : '']
        );
        $request->validate(
            [
            'name' => 'required|string|max:255',
            'email' => 'required|string|email|max:255|unique:users',
            'password' => 'required|string|min:6|confirmed',
            ]
        );

        event(new Registered($user = $this->create($request->all())));

        $this->guard()->login($user);

        return $this->registered($request, $user)
            ?: redirect($this->redirectPath());
    }
576126
public function handleRequest(Request $request): void
    {
        $this->getForm()->handleRequest($request);
        $this->handleForm($request->get('page'));
    }
1106670
public function registerAction($request)
    {
        $modelUser = new ModelUser();
        $data = $request->get('data');
        $error = false;

        if ($this->isAuthenticated()) {
            $this->setMessage('error', 'You are logged in');
            $error = true;
        }

        if (!filter_var($data['model']['email'], FILTER_VALIDATE_EMAIL)) {
            $this->setMessage('error', 'That is not an Email');
            $error = true;
        }

        if ($modelUser->findByName($data['model']['username'])) {
            $this->setMessage('error', 'Your account exists');
            $error = true;
        }

        if ($modelUser->findByEmail($data['model']['email'])) {
            $this->setMessage('error', 'Your Email is already registered');
            $error = true;
        }

        if (empty($data['model']['password'])) {
            $this->setMessage('error', 'You need to select a password');
            $error = true;
        }

        if (empty($data['model']['email'])) {
            $this->setMessage('error', 'You need to select an email');
            $error = true;
        }

        if (empty($data['model']['username'])) {
            $this->setMessage('error', 'You need to select an User Name');
            $error = true;
        }

        if (!$error) {
            $modelUser->resetObject();
            $modelUser->username = $data['model']['username'];
            $modelUser->password = md5($data['model']['password']);
            $modelUser->email = $data['model']['email'];
            $modelUser->address = $data['model']['address'];
            $modelUser->phone = $data['model']['phone'];
            $modelUser->save();
            return $this->twig()->render('user\registerAction.twig');
        } else {
            return $this->twig()->render('user\register.twig', array(
                'data' => $data
            ));
        }

    }
350632
public function run(Request $request) {
		$prefs = $this->getServiceContainer()->getPreferenceLoader()->getSystemPreferences();
		$translator = $this->getServiceContainer()->getTranslator();

		return $this->responder->run($request, new Success([
			'account_url' => $prefs->getAccountUrl(),
			'destination' => $prefs->getAccountUrl() . '/' . $translator->trans('slug.login'),
			'redirect' => $request->getUri(),
			'login_label' => $prefs->getUserLogin()
		]));
	}
1116320
public function postRegister(RegisterRequest $request)
    {
        if (! \Setting::get('user::enable-registration')) {
            return redirect()->route('login');
        }

        \Auth::login($this->create($request->all()));

        return redirect($this->redirectPath());
    }
1200448
public function doRegisterAction(Request $request)
    {
        $user = new User();

        $form = $this->createRegisterForm($user);
        $form->handleRequest($request);

        if ($form->isValid()) {

            // FIXME: This have to be in the service.
            $user->setStatus(User::STATUS_ACTIVE);

            $userManager = $this->container->get('flowcode.user');
            $userManager->create($user);

            // //FIXME: firewall name in security.yml
            // $firewall = 'public';
            // $token = $userManager->getAuthToken($user, $user->getPlainPassword(), $firewall);
            // // Fire the login event
            // // Logging the user in above the way we do it doesn't do this automatically
            // $event = new InteractiveLoginEvent($request, $token);
            // $userManager->loginUser($event);

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

        return array(
            'form' => $form->createView(),
        );
    }
439934
protected function sendRequest(Request $request): Response
    {
        // Set password authentication for request.
        if ($this->password !== null) {
            $request->authenticate($this->password);
        }

        $this->send((string) $request);
        $response = new Response($this->get());
        return $response;

    }
1341360
public function handle($request)
	{
		$entity = $this->repository()->findById($request->getId());

        $this->authorize($request, $entity);

        if ($relatedEntity = $this->getProperty($entity, $this->field())) {
            return $this->response()->resource($request,
                new Item($relatedEntity, $this->transformer())
            );
        }

        return $this->response()->resource($request, new NullResource());
	}
44320
public function handle($request)
    {
        $entity = $this->repository()->findById($request->getId());

        $this->authorize($request, $entity);

        $this->repository()->getEntityManager()->remove($entity);
        $this->repository()->getEntityManager()->flush();

        return RestResponse::noContent();
    }
986719
public function run(Request $request) {
		$page = $this->getServiceContainer()->getKernel()->getApplication()->getPage();
		$page->setTitle($this->getServiceContainer()->getTranslator()->trans('sessions'));

		if ($request->isMethod('POST')) {
			$post = $request->request;
			if ($post->has('token')) {
				SessionQuery::create()->findOneByToken($post->get('token'))->delete();
				$service = $this->getServiceContainer();
				$accountUrl = $service->getPreferenceLoader()->getSystemPreferences()->getAccountUrl();
				$translator = $service->getTranslator();
				$url = sprintf('%s%s/%s',
					$accountUrl,
					$translator->trans('slug.settings'),
					$translator->trans('slug.settings.sessions')
				);
				return new RedirectResponse($url);
			}
		}

		return $this->responder->run($request);
	}
95780
public function handle($request)
    {
        $entity = $this->repository()->findById($request->getId());
        $this->authorize($request, $entity);

        $item = $this->hydrateEntity($this->related()->getClassName(), $request->getData());
        $this->validateEntity($item);
        $this->related()->getEntityManager()->persist($item);
        $this->setProperty($entity, $this->field(), $item);

        $this->related()->getEntityManager()->flush($entity);

        return $this->response()->resource($request,
            new Item($item, $this->transformer(), $this->related()->getResourceKey()),
            RestResponse::HTTP_CREATED
        );
    }
97525
public function registerAction(Request $request)
    {
        $selfRegistration = $this->platformConfigHandler->getParameter('allow_self_registration');
        $casLogin = $request->getSession()->get('CAS_AUTHENTICATION_USER_ID');
        if (empty($casLogin) || !$selfRegistration) {
            return $this->redirectToRoute('claro_index');
        }
        $user = new User();
        if ($this->isValidMail($casLogin)) {
            $user->setEmail($casLogin);
        } else {
            $user->setUsername($casLogin);
        }

        $form = $this->casManager->getRegistrationForm($user);

        return ['form' => $form->createView()];
    }
646023
public function register(Request $request)
    {
        $data = $request->only('email', 'password');

        return DB::transaction(function() use ($data) {
            $user = User::create([
                'name' => $data['email'],
                'email' => $data['email'],
                'password' => bcrypt($data['password']),
            ]);

            $user = $this->service->create($user, $data['password']);
            $token = JWTAuth::fromUser($user);

            return response()->json(compact('token'));
        });
    }