Override default Joomla Login page

  • Views Views: 25,576
  • Last updated Last updated:
  • Copying The Template​

    Copy the contents of:

    components/com_users/views/login/tmpl

    to:

    your_template/html/com_users/login

    Override The Language Files​

    To override the language file associated with this component, copy the necessary string ie:

    COM_USERS_LOGIN_USERNAME_LABEL="User Name"

    from:

    language/en-GB/en-GB.com_users.ini

    to a file called:

    language/overrides/en-GB.override.ini

    and:

    JGLOBAL_PASSWORD="Password"

    JLOGIN="Log in"

    JLOGOUT="Log out"

    JGLOBAL_YOU_MUST_LOGIN_FIRST="Please login first"

    from:

    language\en-GB\en-GB.ini

    to the same override file as above ie:

    language/overrides/en-GB.override.ini

    For the login module, copy:

    MOD_LOGIN_VALUE_USERNAME="User Name"

    MOD_LOGIN_REMEMBER_ME="Remember Me"

    MOD_LOGIN_FORGOT_YOUR_PASSWORD="Forgot your password?"

    MOD_LOGIN_FORGOT_YOUR_USERNAME="Forgot your username?"

    from:

    language/en-GB/en-GB.mod_login.ini

    to the same override fille as above ie:

    language/overrides/en-GB.override.ini

    Style The Form​

    This is an 'embedded' method of styling that only effects the login form - if anyone can provide code for how to define this styling as a separate fieldset in the Joomla template css, please do!

    In your new copy of templates/your_template/html/com_users/login/deafult_login.php, find:

    PHP:

    <form action="<?php echo JRoute::_('index.php?option=com_users&task=user.login'); ?>" method="post">

    <fieldset>
    <?php foreach ($this->form->getFieldset('credentials') as $field): ?>
    <?php if (!$field->hidden): ?>
    <div class="login-fields"><?php echo $field->label; ?>
    <?php echo $field->input; ?></div>
    <?php endif; ?>
    <?php endforeach; ?>
    <button type="submit" class="button"><?php echo JText::_('JLOGIN'); ?></button>
    <input type="hidden" name="return" value="<?php echo base64_encode($this->params->get('login_redirect_url', $this->form->getValue('return'))); ?>" />
    <?php echo JHtml::_('form.token'); ?>
    </fieldset>
    </form>

    and replace with:

    PHP:


    <form action="<?php echo JRoute::_('index.php?option=com_users&task=user.login'); ?>" method="post">

    <fieldset style="border: 1px solid #CCCCCC; border-radius: 5px 5px 5px 5px; margin: 50px auto 0 auto; padding-bottom: 50px; padding-left: 50px; padding-top: 50px; width: 350px;">
    <p style="margin-bottom: 5px;">type a message here if you would like.</p>
    <?php foreach ($this->form->getFieldset('credentials') as $field): ?>
    <?php if (!$field->hidden): ?>
    <div class="login-fields"><?php echo $field->label; ?>
    <?php echo $field->input; ?></div>
    <?php endif; ?>
    <?php endforeach; ?>
    <button type="submit" class="button" style="float: right; margin: 10px 87px 0 0;"><?php echo JText::_('JLOGIN'); ?></button>
    <input type="hidden" name="return" value="<?php echo base64_encode($this->params->get('login_redirect_url', $this->form->getValue('return'))); ?>" />
    <?php echo JHtml::_('form.token'); ?>
    </fieldset>
    </form>

Back
Top