Wednesday, October 30, 2013

Custom Login module creation in Magento 2



Some modifications in my earlier post adding to that i have changed my view.phtml file,

My previous blog
There is a slight modification in the view.phtml file



If you are not able to see the image please check the below codes.

<?php if (!Mage::getSingleton('customer/session')->isLoggedIn()){
$login_url  = $this->getUrl('*/*/login', array('_secure'=>(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']==='on')));
$http_mode  = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']==='on');
if($http_mode)
    $login_url  = str_replace('http:', 'https:', $login_url);  
?>
    <form method="post" id="login-form" action="<?php echo $login_url ?>">
    <ul class="form-list">
            <li>
                <label class="required" for="login:email"><em>*</em><?php echo $this->__('Email') ?></label>
                <div class="input-box">
                    <input type="text" name="login[username]" value="<?php echo $this->htmlEscape($this->getUsername()) ?>" placeholder="Email" id="email" class="input-text required-entry validate-email" title="<?php echo $this->__('Email Address') ?>" />
                </div>
            </li>
            <li>
                <label class="required" for="login:password"><em>*</em><?php echo $this->__('Password') ?></label>
                <div class="input-box">
                    <input type="password" name="login[password]" class="input-text required-entry validate-password" placeholder="Password" id="pass" title="<?php echo $this->__('Password') ?>" />
                </div>
             </li>

<button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button> </ul></form>
<?php }?>
 <script type="text/javascript">
    //<![CDATA[
        var loginForm = new VarienForm('login-form', true);
    //]]>
    </script>