protected function indexProfile()
    {
        if (!$this->AllowProfileEditing) {
            if ($this->AllowAdding && Injector::inst()->get(Member::class)->canCreate()) {
                return $this->redirect($this->Link('add'));
            }

            return Security::permissionFailure($this, _t(
                'MemberProfiles.CANNOTEDIT',
                'You cannot edit your profile via this page.'
            ));
        }

        $member = Member::currentUser();

        foreach ($this->Groups() as $group) {
            if (!$member->inGroup($group)) {
                return Security::permissionFailure($this);
            }
        }

        $form = $this->ProfileForm();
        $form->loadDataFrom($member);

        if ($password = $form->Fields()->fieldByName('Password')) {
            if ($password->hasMethod('setCanBeEmpty')) {
                $password->setCanBeEmpty(false);
                $password->setValue(null);
                $password->setCanBeEmpty(true);
            } else {
                // If Password field is ReadonlyField or similar
                $password->setValue(null);
            }
        }

        $data = array(
            'Type'    => 'Profile',
            'Title'   => $this->obj('ProfileTitle'),
            'Content' => $this->obj('ProfileContent'),
            'Form'    => $form
        );

        return $this->customise($data);
    }