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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:23:35+00:00 2026-05-19T23:23:35+00:00

I have an existing, non-framework-based PHP/MySQL website. It has a simple security model, with

  • 0

I have an existing, non-framework-based PHP/MySQL website. It has a simple security model, with a users table with usernames and hashed (MD5) passwords.

I’m currently working on “version 2” of this site, this time using Symfony, with Doctrine. The new version is working fine, and I’m using the sfDoctrineGuard plugin for my user management.

I’d like to migrate my existing users into the new app with the minimum of fuss, retaining their existing usernames and passwords. My main problem, though, is that I’d like to change the password hash I’m using.

The current site uses unsalted MD5 hashes of the passwords*. I’ve already figured out how to migrate users to Symfony/sfDoctrineGuard while maintaining the existing algorithm (by providing my own “algorithm” function for unsalted MD5.) But unsalted md5 obviously isn’t ideal.

So — my question is, given a bunch of users that I can successfully migrate into sfDoctrineGuard users with my custom plain-MD5 password hashing algorithm, is there any way I can then transform those users so they use the standard, salted SHA1 sfDoctrineGuard algorithm?

I figure I’ll only be able to do this per-user as each user logs in, as that’s the only time I’ll have the user’s plaintext password for re-hashing. I guess what I need to do is hook into something at the “this user just successfully logged in with this password” point so I can then set the user’s algorithm, salt and password to the new SHA1 system, and save the user back to the database without them even knowing about it.

I’ve dug around a bit and I can’t figure out a way to override or hook into the sfDoctrineGuard (specifically sfGuardSecurityUser, I think?) login system at the right point. Well, not without hacking around with the actual plugin files, which seems evil.

Can any Symfony/sfDoctrineGuard experts out there point me in the right direction?

*Don’t look at me like that, it was my first website! And at least I didn’t store them plaintext…

  • 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-19T23:23:35+00:00Added an answer on May 19, 2026 at 11:23 pm

    You have plenty of options to solve your issues.

    You’re able to overload or change almost everything in sfDoctrineGuardPlugin.

    If you need to change something in sfGuardSecurityUser than you can do it in your application’s User class (which actually extends sfGuardSecurityUser).

    It’s also possible to overload model classes which are by default put into lib/model/doctrine/sfDoctrineGuardPlugin directory.

    You can extend default guard schema as well. You could for example add a field telling you if user changed the password and update it if he didn’t.

    Finally you’re able to implement your custom password checking and setting algorithm:
    http://www.symfony-project.org/plugins/sfDoctrineGuardPlugin?tab=plugin_readme (scroll to “Check the user password with an external method” and “Change the algorithm used to store passwords”).

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

Sidebar

Related Questions

No related questions found

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.