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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:21:34+00:00 2026-05-31T07:21:34+00:00

I’m currently designing a small website and I’d like to implement the forgot your

  • 0

I’m currently designing a small website and I’d like to implement the “forgot your password?” feature. Here is my idea:

forgot your password web page will have this:

Email: (input box)
(button: "Make temp password")

On “Make temp password” button click:

  1. Sanitize email input for SQLi/XSS
  2. Check to see that the email address exists in the database
    • if not, tell user to make new account or check email spelling
  3. Create random password (ie “xh5MvQe”) and put it in database in the user’s temp password field.
    • overwrite if already exists. do not touch the main password. the user will be able to log in with two passwords for the next 48 hours.
  4. Get the current UTC time plus 48 hours and put it in the user’s temp password expiry date field in database. overwrite if already exists.
  5. Send email to user with the temp password

My database has these fields for the user table:

(primary key) user id
name
nickname
(non null, unique) email
(non null) password (encrypted)
temporary password
temporary password expiration

Once the user has the password, they can log in and change their main password.

Question is: is this a secure way to implement this feature? My main concern is sending a plain text password via email. I’ve seen the other way of generating a link with email hashed/timestamp/random id as a GET parameter, but I don’t see how that’s any more secure. Please correct me if I’m wrong.

  • 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-31T07:21:36+00:00Added an answer on May 31, 2026 at 7:21 am

    Read this: The definitive guide to form-based website authentication

    It’s bad to send the users any passwords, because you can’t be sure if his machine/email account is/will be secure. If you generate and send a password, the user might not change it. You can’t avoid to send some kind of identification token for recovery though, so an expiration date is a good idea.

    Never store plain passwords anywhere. Use a salted hash. An attacker getting access to your database is bad enough, but it’s even worse for users who used the same password for other services – and they always do this, silly users.

    So, this is a way to avoid saving plain text passwords on a users machine:

    1. Sanitize email input for SQLi/XSS
    2. Check to see that the email address exists in the database
      • if not, tell user to make new account or check email spelling
    3. Create random recovery login token (ie “xh5MvQe”) and put it’s hash in database in the user’s password recovery hash field.
      • overwrite if already exists. do not touch the main password. The user will be able to
        • log in with his old password, deleting the recovery hash.
        • log in with the recovery token passwords once, in the next 48 hours, which forces the user to choose a new password.
    4. Get the current UTC time plus 48 hours […]
    5. Send email to user with the one-time recovery login token link.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
I am currently running into a problem where an element is coming back from
I want use html5's new tag to play a wav file (currently only supported

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.