@param Request       $request
@param UserInterface $user
@param boolean       $selfEdit

@return Response
554276
protected function renderForm(Request $request, UserInterface $user, $selfEdit)
    {
        $action = $this->generateUrl('open_orchestra_user_admin_user_form', array('userId' => $user->getId()));
        $editGroups = true;

        if ($selfEdit) {
            $action = $this->generateUrl('open_orchestra_user_admin_user_self_form');
            $editGroups = false;
        }

        $form = $this->createForm('oo_user', $user, array(
            'action' => $action,
            'edit_groups' => $editGroups,
            'self_editing' => $selfEdit,
            'validation_groups' => array('Profile', 'UpdatePassword', 'Default'),
            )
        );
        $form->handleRequest($request);

        if ($form->isValid()) {
            if ('' != $user->getPlainPassword()) {
                $userManager = $this->get('fos_user.user_manager');
                $userManager->updatePassword($user);
                $this->dispatchEvent(UserEvents::USER_CHANGE_PASSWORD, new UserEvent($user));
            }
            $this->handleForm($form, $this->get('translator')->trans('open_orchestra_user_admin.update.success'));
            $this->dispatchEvent(UserEvents::USER_UPDATE, new UserEvent($user));
        }

        return $this->renderAdminForm($form);
    }
44751
public function index($selfedit = "false") {
		$this->selfedit = $selfedit;
		$this->status = true;

		try {
			$this->status = MoufReflectionProxy::checkConnection();
		} catch (MoufException $e) {
			$this->status = false;
		}

		$this->localUrl = MoufReflectionProxy::getLocalUrlToProject();

		$this->contentBlock->addFile(ROOT_PATH."src-dev/views/configureLocalUrl.php", $this);
		$this->template->toHtml();
	}
1320871
public function getUserAssertionsAction(Request $request, User $user)
    {
        $assertions = $this->finder->search(Assertion::class, array_merge(
            $request->query->all(),
            ['hiddenFilters' => ['recipient' => $user->getUuid()]]
        ));

        return new JsonResponse($assertions);
    }
844744
public function defaultAction($selfedit = "false") {
		// Before running the other validation steps, we should make sure we can successfully cURL
		// into the server, from the server.
		try {
			if (!MoufReflectionProxy::checkConnection()) {
				$this->contentBlock->addFile(ROOT_PATH."src-dev/views/connection-problem.php", $this);
				$this->template->toHtml();
				return;
			}
		} catch (MoufException $e) {
			$this->contentBlock->addFile(ROOT_PATH."src-dev/views/connection-problem.php", $this);
			$this->template->toHtml();
			return;
		}

		$this->contentBlock->addFile(ROOT_PATH."src-dev/views/validate.php", $this);
		$this->template->toHtml();
	}
528126
public function messageAction(ServerRequestInterface $request, Tree $tree, UserInterface $user): ResponseInterface
    {
        $body    = $request->get('body', '');
        $subject = $request->get('subject', '');
        $to      = $request->get('to', '');
        $url     = $request->get('url', '');

        $to_user = $this->user_service->findByUserName($to);
        $ip      = $request->getClientIp() ?? '127.0.0.1';

        if ($to_user === null || $to_user->getPreference('contactmethod') === 'none') {
            throw new AccessDeniedHttpException('Invalid contact user id');
        }

        if ($body === '' || $subject === '') {
            return redirect(route('message', [
                'body'    => $body,
                'subject' => $subject,
                'to'      => $to,
                'tree'    => $tree,
                'url'     => $url,
            ]));
        }

        if ($this->deliverMessage($tree, $user, $to_user, $subject, $body, $url, $ip)) {
            FlashMessages::addMessage(I18N::translate('The message was successfully sent to %s.', e($to_user->realName())), 'success');

            $url = $url ?: route('tree-page', ['ged' => $tree->name()]);

            return redirect($url);
        }

        FlashMessages::addMessage(I18N::translate('The message was not sent.'), 'danger');

        $redirect_url = route('contact', [
            'body'    => $body,
            'subject' => $subject,
            'to'      => $to,
            'url'     => $url,
        ]);

        return redirect($redirect_url);
    }
143155
public function edit(Resource $instance, $form, $userId = null)
    {
        try {
            $uploadedFile = $this->fetchUploadedFile($form);

            $xmlFile = $this->getSharedStimulusFile($uploadedFile);

            $this->getUploadService()->remove($uploadedFile);

            // throws an exception of invalid
            SharedStimulusImporter::isValidSharedStimulus($xmlFile);

            $embeddedFile = static::embedAssets($xmlFile);

            $report = $this->replaceSharedStimulus($instance, $this->getDecodedUri($form), $embeddedFile, $userId);
        } catch (\Exception $e) {
            $message = $e instanceof common_exception_UserReadableException
                ? $e->getUserMessage()
                : __('An error has occurred. Please contact your administrator.');
            $report = Report::createFailure($message);
            $this->logError($e->getMessage());
            $report->setData(['uriResource' => '']);
        }

        return $report;
    }
886385
public function enableAction(Request $request, $userClass)
    {
        $confirmationToken = $request->query->get('token');
        if (null === $confirmationToken) {
            return new JsonResponse(null, 404);
        }

        try {
            $this->get('bengor_user.' . $userClass . '.api_command_bus')->handle(
                new EnableUserCommand($confirmationToken)
            );

            return new JsonResponse();
        } catch (UserTokenNotFoundException $exception) {
            return new JsonResponse(
                sprintf(
                    'The "%s" confirmation token does not exist',
                    $confirmationToken
                ),
                400
            );
        }
    }
673121
public function verify(ServerRequestInterface $request, Tree $tree, UserService $user_service): ResponseInterface
    {
        $username = $request->get('username', '');
        $token    = $request->get('token', '');

        $title = I18N::translate('User verification');

        $user = $user_service->findByUserName($username);

        if ($user instanceof User && $user->getPreference('reg_hashcode') === $token) {
            // switch language to webmaster settings
            $webmaster = $user_service->find((int) $tree->getPreference('WEBMASTER_USER_ID'));

            if ($webmaster instanceof User) {
                I18N::init($webmaster->getPreference('language'));

                /* I18N: %s is a server name/URL */
                $subject = I18N::translate('New user at %s', WT_BASE_URL . ' ' . $tree->title());

                Mail::send(
                    new TreeUser($tree),
                    $webmaster,
                    new TreeUser($tree),
                    $subject,
                    view('emails/verify-notify-text', ['user' => $user]),
                    view('emails/verify-notify-html', ['user' => $user])
                );

                $mail1_method = $webmaster->getPreference('CONTACT_METHOD');

                if ($mail1_method !== 'messaging3' && $mail1_method !== 'mailto' && $mail1_method !== 'none') {
                    DB::table('message')->insert([
                        'sender'     => $username,
                        'ip_address' => $request->getClientIp(),
                        'user_id'    => $webmaster->id(),
                        'subject'    => $subject,
                        'body'       => view('emails/verify-notify-text', ['user' => $user]),
                    ]);
                }
                I18N::init(WT_LOCALE);
            }

            $user
                ->setPreference('verified', '1')
                ->setPreference('reg_timestamp', date('U'))
                ->setPreference('reg_hashcode', '');

            Log::addAuthenticationLog('User ' . $username . ' verified their email address');

            return $this->viewResponse('verify-success-page', [
                'title' => $title,
            ]);
        }

        return $this->viewResponse('verify-failure-page', [
            'title' => $title,
        ]);
    }
533463
public function defaultAction(Request $request, $userClass)
    {
        $form = $this->get('form.factory')->createNamedBuilder('', ChangePasswordType::class, null, [
            'csrf_protection' => false,
        ])->getForm();

        return $this->processForm($form, $request, $userClass);
    }
603902
public function getPageAction(ServerRequestInterface $request, Tree $tree, UserInterface $user): ResponseInterface
    {
        Auth::checkComponentAccess($this, 'list', $tree, $user);
      
        $listController = new BranchesController(app(ModuleService::class));
        return $listController->page($request);
    }
348138
public function getValidUserSession(Request $request, $userId, $sessionCode)
    {
        $session = SecUserSessions::whereuserid($userId)
            ->wheresessioncode($sessionCode)
            ->wheredateins(date('Y-m-d'))
            ->wherestatus(1)
            ->first();

        $ipAddress = $request->ip();

        if ($session) {

            if ($session->datetimeUpd < date('Y-m-d H:m:s')) {
                $session->update(['ipAddress' => $ipAddress, 'datetimeUpd' => date('Y-m-d H:m:s')]);
            }

            if ($session->datetimeUpd < date('Y-m-d H:m:s') || $session->ipAddress == $ipAddress) {

                $data = $session->user;
                $data->ipAddress = $ipAddress;
                $data->sessionCode = $session->sessionCode;
                $data->userSessionId = $session->userSessionId;
                $data->environment = $this->environment;
                $data->remember_token = $session->user->remember_token;

                $this->responseData = $data;
                $this->responseSuccess = true;
            }

        }

        return EncryptAes::encrypt(json_encode($this->responseRagnarok->make(
            $this->responseSuccess, $this->responseData
        )));
    }
38196
public function saveUser(User $user, Request $request)
    {
        $user->fill($request->get('user'))
            ->save();

        Alert::info(__('User was saved.'));

        return back();
    }
26716
public function refresh($selfedit = "false") {
		$this->selfedit = $selfedit;
		
		$moufCache = new MoufCache();
		$moufCache->purgeAll();
		
		header("Location: .?selfedit=".$selfedit);
	}
386278
public function edit(Request $request, $user)
    {
        // Set roles that have access
        $request->user()->authorizeRoles(['admin']);

        // Return view with user object
        $user = User::findOrFail($user);
        return view('user::edit', ['user' => $user]);
    }
692036
public function userPageEdit(Tree $tree, UserInterface $user): ResponseInterface
    {
        $main_blocks = $this->userBlocks($user->id(), 'main');
        $side_blocks = $this->userBlocks($user->id(), 'side');
        $all_blocks  = $this->availableUserBlocks();
        $title       = I18N::translate('Change the “My page” blocks');
        $url_cancel  = route('user-page', ['ged' => $tree->name()]);
        $url_save    = route('user-page-update', ['ged' => $tree->name()]);

        return $this->viewResponse('edit-blocks-page', [
            'all_blocks'  => $all_blocks,
            'can_reset'   => true,
            'main_blocks' => $main_blocks,
            'side_blocks' => $side_blocks,
            'title'       => $title,
            'url_cancel'  => $url_cancel,
            'url_save'    => $url_save,
        ]);
    }
736035
public function log(RequestInterface $request = null, User $user = null)
    {
        if ($request === null) {
            $request = ServerRequest::fromGlobals();
        }

        if ($user === null) {
            $user = \common_session_SessionManager::getSession()->getUser();
        }
       return  $this->getStorage()->log($request, $user);
    }
1312122
public function byInvitationAction(Request $request, $userClass)
    {
        $invitationToken = $request->query->get('token');
        try {
            // we need to know if the invitation token given exists in
            // database, in case that it isn't, it throws 404.
            $user = $this->get('bengor_user.' . $userClass . '.by_invitation_token_query')->__invoke(
                new UserOfInvitationTokenQuery($invitationToken)
            );
        } catch (UserDoesNotExistException $exception) {
            return new JsonResponse(null, 404);
        } catch (UserTokenExpiredException $exception) {
            return new JsonResponse(null, 404);
        } catch (\InvalidArgumentException $exception) {
            return new JsonResponse(null, 404);
        }

        $form = $this->get('form.factory')->createNamedBuilder('', SignUpByInvitationType::class, null, [
            'roles'            => $this->getParameter('bengor_user.' . $userClass . '_default_roles'),
            'invitation_token' => $invitationToken,
            'csrf_protection'  => false,
        ])->getForm();

        $form->handleRequest($request);
        if ($form->isValid()) {
            $commandBus = $this->get('bengor_user.' . $userClass . '.api_command_bus');

            try {
                $commandBus->handle(
                    $form->getData()
                );
                $commandBus->handle(
                    new LogInUserCommand(
                        $user['email'],
                        $form->getData()->password()
                    )
                );
            } catch (UserDoesNotExistException $exception) {
                return new JsonResponse(null, 404);
            } catch (UserInactiveException $exception) {
                return new JsonResponse(null, 404);
            } catch (UserPasswordInvalidException $exception) {
                return new JsonResponse('Bad credentials', 400);
            } catch (UserAlreadyExistException $exception) {
                return new JsonResponse('Bad credentials', 400);
            }
            $token = $this->get('lexik_jwt_authentication.encoder.default')->encode(['email' => $user['email']]);

            return new JsonResponse(['token' => $token]);
        }

        return new JsonResponse(FormErrorSerializer::errors($form), 400);
    }