src/Pages/MemberProfilePageController.php
public function register($data, Form $form)
    {
        $member = $this->addMember($form);
        if (!$member) {
            return $this->redirectBack();
        }

        // If they can login, immediately log them in
        if ($member->canLogin()) {
            Injector::inst()->get(IdentityStore::class)->logIn($member);
        }

        if ($this->RegistrationRedirect) {
            if ($this->PostRegistrationTargetID) {
                $this->redirect($this->PostRegistrationTarget()->Link());
                return;
            }

            $session = $this->getRequest()->getSession();
            $sessionTarget = $session->get('MemberProfile.REDIRECT');
            if ($sessionTarget) {
                $session->clear('MemberProfile.REDIRECT');
                if (Director::is_site_url($sessionTarget)) {
                    return $this->redirect($sessionTarget);
                }
            }
        }

        return $this->redirect($this->Link('afterregistration'));
    }
public function register($data, Form $form)
    {
        $member = $this->addMember($form);
        if (!$member) {
            return $this->redirectBack();
        }

        // If they can login, immediately log them in
        if ($member->canLogin()) {
            Injector::inst()->get(IdentityStore::class)->logIn($member);
        }

        if ($this->RegistrationRedirect) {
            if ($this->PostRegistrationTargetID) {
                $this->redirect($this->PostRegistrationTarget()->Link());
                return;
            }

            $session = $this->getRequest()->getSession();
            $sessionTarget = $session->get('MemberProfile.REDIRECT');
            if ($sessionTarget) {
                $session->clear('MemberProfile.REDIRECT');
                if (Director::is_site_url($sessionTarget)) {
                    return $this->redirect($sessionTarget);
                }
            }
        }

        return $this->redirect($this->Link('afterregistration'));
    }
public function register ( $ data , Form $ form ) { $ member = $ this -> addMember ( $ form ) ; if ( ! $ member ) { return $ this -> redirectBack ( ) ; } // If they can login, immediately log them in if ( $ member -> canLogin ( ) ) { Injector :: inst ( ) -> get ( IdentityStore :: class ) -> logIn ( $ member ) ; } if ( $ this -> RegistrationRedirect ) { if ( $ this -> PostRegistrationTargetID ) { $ this -> redirect ( $ this -> PostRegistrationTarget ( ) -> Link ( ) ) ; return ; } $ session = $ this -> getRequest ( ) -> getSession ( ) ; $ sessionTarget = $ session -> get ( 'MemberProfile.REDIRECT' ) ; if ( $ sessionTarget ) { $ session -> clear ( 'MemberProfile.REDIRECT' ) ; if ( Director :: is_site_url ( $ sessionTarget ) ) { return $ this -> redirect ( $ sessionTarget ) ; } } } return $ this -> redirect ( $ this -> Link ( 'afterregistration' ) ) ; }
Handles validation and saving new Member objects, as well as sending out validation emails.
Handles validation and saving new Member objects as well as sending out validation emails .