You can do this by following the below steps:
Using XML Layout:
You have to create a layout file specifically for your CMS Page, such as in layout folder of your custom module,
cms_page_view_selectable_<CMS Page Identifier>_<Layout Update Name>.xml
for example if my CMS page identifier name is testing, I'll name it as cms_page_view_selectable_testing_loginform.xml and inside the file I can write code as below to get the login form and remember me option as well:
<?xml version="1.0"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <head> <title>Customer Login</title> </head> <body> <referenceContainer name="content"> <block class="Magento\Customer\Block\Form\Login" name="customer_form_login" template="Magento_Customer::form/login.phtml"> <container name="form.additional.info" as="form_additional_info"> <block class="Magento\Persistent\Block\Form\Remember" name="persistent.remember.me" template="Magento_Persistent::remember_me.phtml" before="-"/> </container> </block> </referenceContainer> </body> </page>
And than go to your CMS page in admin and from there under design tab, select your option in Custom Layout Update, whatever you've named it, here I have named it loginform, so I'll select loginform inside my Custom Layout Update.
You can also define blocks as one after another, just saying as a possible way:
In your CMS page you have to define both blocks such as, in your CMS block:
{{block class="Magento\Customer\Block\Form\Login" template="Magento_Customer::form/login.phtml" name="customer.login.container"}} {{block class="Magento\Persistent\Block\Form\Remember" template="Magento_Persistent::remember_me.phtml" name="persistent.remember.me"}}
Now, in your cms_page_view.xml file:
<move element="persistent.remember.me" destination="customer.login.container" before="-"/>
Another way:
In your CMS block where you're calling a login block, assign a new template file such as:
{{block class="Magento\Customer\Block\Form\Login" template="YourCustomVendorName_ModuleName::form/login.phtml" name="customer.login.container"}}
Copy Magento_Customer::form/login.phtml file to YourCustomVendorName_ModuleName::form/login.phtml
And inside login.phtml file replace,
<?= $block->getChildHtml('form_additional_info') ?>
With
<?php echo $this->getLayout() ->createBlock('Magento\Persistent\Block\Form\Remember') ->setTemplate('Magento_Persistent::remember_me.phtml') ->toHtml(); ?>
Now you should have Remember me same as login in your CMS page.