How to create a login page with registration?

Asked

Viewed 167 times

1

I’m creating a web application in cakephp and I’m having doubts because I can’t create the log-in button on the login page.

My code is this on \View\Users\login.ctp:

<div class="container">
    <div class="login-content">
        <?php echo $this->Html->image('logo1.png', array('alt' => 'fivassist Logo')); ?>

        <?php echo $this->Form->create('User'); ?>
        <div class="login-form">
            <h2>Bem-vindo!</h2>
            <ul>
                <li>
                    <label>E-mail:</label>
                    <?php echo $this->Form->input('email', 
                        array('label' => false, 'autocomplete' => 'off')); ?>
                </li>
                <li><label>Password:</label>
                    <?php echo $this->Form->input('password', 
                        array('label' => false, 'autocomplete' => 'off')); ?>
                </li>
            </ul>
        </div> <!-- end login-form -->
        <?php echo $this->Session->flash(); ?>
        <?php echo $this->Form->submit('Login', array('id' => 'login-bt')); ?>
        <a href="#" id="forgot">Esqueceu-se da sua password?</a>

            <a href="">Regista-te</a>

    </div> <!-- end login-content -->
</div> <!-- end container -->

I’ve tried it this way and I can’t get the add.ctp of user.

1 answer

1

Change this line:

<?php echo $this->Form->submit('Login', array('id' => 'login-bt')); ?>

To:

<?php echo $this->Form->end('Login', array('id' => 'login-bt')); ?>

The method end creates the Submit button with the properties defined in the array, and adds the tag </form> in the end.

And also here:

    <label>E-mail:</label>
    <?php echo $this->Form->input('email', 
                array('label' => false, 'autocomplete' => 'off')); ?>

You can just do this:

 <?php echo $this->Form->input('email', 
                array('label' => 'E-mail:', 'autocomplete' => 'off')); ?>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.