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

  • Home
  • SEARCH
  • 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 8612841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:43:36+00:00 2026-06-12T04:43:36+00:00

Hello I’m trying to do a login with Symfony2 and database table with passwords

  • 0

Hello I’m trying to do a login with Symfony2 and database table with passwords in md5 with no salt field. I have a lot of users and I can’t change it.

The login seems to work fine when I send form with invalid email, it returns the message right “Bad credentials”. But when I send form with good email it says “The presented password is invalid.”

What’s wrong?

I config the firewall:

security:
    encoders:
        Usuari\BackendBundle\Entity\Usuari:
            algorithm: md5

Implement UserInterface in Usuari entity, with no salt

    public function getUsername()
    {
        return $this->email;
    }

    public function getSalt() { 
        return '';
    }

    public function getPassword()
    {
        return $this->clau;
    }

    public function getRoles()
    {
        return array('ROLE_ADMIN');
    }

    public function eraseCredentials() { }

    public function equals(UserInterface $user)
    {
        return $this->email === $user->getUsername();
    }

And security controlles at /login route:

namespace Mes\BackendBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Security\Core\SecurityContext;


    class SecurityController extends Controller
    {
        public function loginAction()
        {
            $request = $this->getRequest();
            $session = $request->getSession();

            // get the login error if there is one
            if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
                $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
            } else {
                $error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
            }

            return $this->render('MeBackendBundle:Security:login.html.twig', array(
                // last username entered by the user
                'last_username' => $session->get(SecurityContext::LAST_USERNAME),
                'error'         => $error,
            ));
        }
    }
    ?>
  • 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-12T04:43:37+00:00Added an answer on June 12, 2026 at 4:43 am

    Thomas, this solutions seems works fine, but it is more complex.

    Finally I decide regenerate all passwords from database with other encode function and salt field. I will send an email to the all users with a link that allows these change his password

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

Sidebar

Related Questions

Hello to Everyone. I have two table, for example; TABLE Name X ________________ |
Hello The following procedure will have to move all constraints from one table to
Hello guys I am working on silverlight and I have issue regarding on database
Hello I did login as a super admin in the front en of joomla
Hello I have like this 2 tables class User public int UserId{get;set;} { ....
hello all i am working on a project in which i have a webpage
Hello i'm doing a application in php, and i have a list of items
Hello I've got this query to get users by email, which is an unique
Hello everyone i am trying to format the input number range with php number_format
hello friends i am trying to get a list of user id and want

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.