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 957781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:45:42+00:00 2026-05-16T00:45:42+00:00

currently, to login a user in Zend Framework, i do something like public function

  • 0

currently, to login a user in Zend Framework, i do something like

public function loginAction()
{
    if ($this->getRequest()->isPost()) {
        $adapter = new Application_Auth_Adapter(
                        $this->getRequest()->getParam('username'),
                        $this->getRequest()->getParam('password')
                    );
        $auth = Zend_Auth::getInstance();
        $auth->authenticate($adapter);
        if ($auth->hasIdentity()) {
            echo $auth->getIdentity()->name;
        } else {
            echo "failed login";
        }
    } else {
        echo "not posted";
    }
}

but i am wondering if i shld have all the validation logic

$auth = Zend_Auth::getInstance();
$auth->authenticate($adapter);
if ($auth->hasIdentity()) { ...

put inside a Zend_Validate instead then all my controller does is check if the form isValid()? most tutorials do the authentication in controllers but i am wondering since authenticating a user login sounds like validation to me …

  • 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-05-16T00:45:43+00:00Added an answer on May 16, 2026 at 12:45 am

    I think the act of authenticating a user is separate from validating the user.

    You could have a validator which can be used to test whether a certain set of credentials is valid or not. However, this would usually be a bit redundant, as you can simply pass the credentials to Zend_Auth to determine validity and authenticate the user if so.

    If you wish to separate your login process (maybe it’s a bit more involved than just calling Zend_Auth or you need to do it in more than one place for some reason) from your controller’s logic, you could create a login service class which abstracts the necessary steps.

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

Sidebar

Related Questions

I currently have this method: public function getUser($id) { $user = $this->db->getSingleRecord(SELECT user_id, user_login,
I have currently login User object (userId,organisationId,etc.. ) stored in session by using like
Currently i am working in validate user login, so using procedure to compare username
I currently developed a web site that my user must login to web site.
Currently, in my settings module I have this: LOGIN_URL = '/login' If I ever
I am trying to create a login system with Zend that when a user
I am currently developing a C# Windows Form Application. After the user has login
I am currently working on a zend framework site using an ACL. The ACL
I'm currently building a web application (utilizing Zend Framework) and have gotten some of
I am currently creating user login. If the user logs in with a valid

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.