Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8566171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:35:43+00:00 2026-06-11T17:35:43+00:00

My client inherited an incomplete CMS and I am trying to help them fix

  • 0

My client inherited an incomplete CMS and I am trying to help them fix it. Keep in mind that I come from front end development, some logic that may appear obvious to some of you totally elude me.

So I managed to almost complete and better the CMS, however there is the issue of logging in. If a user enters the right username and password, all works properly.

However, it would be simple courtesy to indicate to the user when something wrong was done, like “retry to enter your password” or some better phrased message. But nothing happens now.

So I looked into the code, ended up comparing these two files:

login.ctp (the view, as I understand it)

<?php
    echo $this->Session->flash('auth');
?>

<div id="loginColumns">

    <!-- input fields -->
    <div id="loginLeftColumn">
        <?php
            echo $this->Form->create('User',array('action'=>'login'));
            echo $this->Form->input('username');
            echo $this->Form->input('password');
        ?>
    </div>

    <!-- login button -->
    <div id="loginRightColumn">
        <?php echo $this->Form->end('Continue'); ?>
    </div>

</div>

UsersController.php (the controller, as the name implies)

<?php
    class UsersController extends AppController
    {
        var $name = 'Users';
        public $scaffold;


        public function beforeFilter()
        {
            $this -> Auth -> allow(array('login', 'logout'));
        }


        public function login()
        {
            if($this -> request -> is('post'))
            {
                if($this -> Auth -> login())
                {
                    $this -> redirect($this -> Auth -> redirect());
                }
                else
                {
                    // this does not work, maybe because there is no session yet
                    // when users have not logged in yet?
                    $this -> Session -> setFlash(__('Invalid username or password, try again'));
                }
            }
        }


        function logout()
        {
            $this -> redirect($this -> Auth -> logout());
        }
    }
?>

As you can see, there seems to be something that handles erros when logging, but there is nothing showing. That setFlash function is used in a couple of places once the user is logged in, and it works like a charm.

Is there any way for me to use it before the user logs in, or do I have to recreate it from scratch? And if so, what could be some leads into doing it so it looks and feels similar?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T17:35:44+00:00Added an answer on June 11, 2026 at 5:35 pm

    Stick with using this in your view:

    <?php echo $this->Session->flash(); ?>
    

    This will display the Flash message you are setting in the controller.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For my project I've trying to extend GWT classes that not inherited with client
Per a client's request I have written a communication class that inherits from webclient.
I've inherited a high-traffic site that loads some Ext javascript files and I'm trying
We've just inherited a massive client project that is in VS.NET 2003. We typically
from a Wcf data service client (inherited from System.Data.Services.Client.DataServiceContext) I would like to invoke
I have inherited a project from a client, who believes he has all the
I inherited this huge application consisting of client and server code, and I'm trying
I inherited a project from a colleague that left the company. While examining his
Inherited properties and MetadataType does not seem to work with client side validation in
Client wants a button on the mobile web app that launches a QR code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.