You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This task involves creating the registration feature for the portfolio website, allowing new users to sign up by providing their details. The registration form must capture essential user information, validate the inputs, and securely store the user’s password using hashing techniques. Proper input validation and security measures will ensure a robust and secure registration process.
Steps to Complete:
Design the Registration Form:
Create a PHP file (e.g., register.php) within the public/ directory to serve as the registration page.
The form should capture the following user details:
Username
Email
Password
Confirm Password
Name (optional)
Profile Picture (optional)
Implement Client-Side Validation:
Use HTML5 form attributes and JavaScript to perform basic client-side validation:
Ensure the username and email are not empty and are in the correct format.
Validate that the password meets complexity requirements (e.g., minimum length, inclusion of numbers or special characters).
Ensure that the "Confirm Password" field matches the "Password" field.
If a profile picture is uploaded, validate the file type and size.
Handle Form Submission:
Upon form submission, process the form data in the same register.php file or another PHP script included via a POST request.
Sanitize the input data using PHP’s built-in functions to prevent SQL injection and cross-site scripting (XSS).
Check if the username or email already exists in the users table to prevent duplicates.
Implement Server-Side Validation:
Validate all inputs on the server side, replicating or enhancing client-side checks.
Ensure the email is in the correct format using filter_var() with FILTER_VALIDATE_EMAIL.
Check that the password meets the complexity requirements server-side.
Confirm that both password fields match.
Hash the Password:
Use PHP’s password_hash() function to securely hash the user’s password before storing it in the database.
Prepare a SQL statement to insert the new user’s data into the users table, ensuring the use of prepared statements to prevent SQL injection.
Store the hashed password, along with other user information (e.g., username, email, name).
Provide Feedback and Redirection:
After successful registration, redirect the user to the login page or a welcome page with a success message.
If there are errors (e.g., validation failure or duplicate email), provide user-friendly error messages and prompt the user to correct their input.
Test the Registration Process:
Thoroughly test the registration process by submitting various inputs, including edge cases (e.g., very long usernames, invalid emails, weak passwords).
Verify that passwords are hashed in the database and that no sensitive data is stored in plain text.
Acceptance Criteria:
The registration form is fully functional, with both client-side and server-side validation.
User passwords are securely hashed using PHP’s password_hash() function before being stored in the database.
Appropriate feedback is provided for successful registrations and validation errors.
The registration process is secure, preventing SQL injection, XSS, and duplicate user registrations.
The text was updated successfully, but these errors were encountered:
andrew21-mch
changed the title
User Registration
Develop a Registration Form and Implement User Registration with Password Hashing (Validation Inclusive)
Aug 16, 2024
Description:
This task involves creating the registration feature for the portfolio website, allowing new users to sign up by providing their details. The registration form must capture essential user information, validate the inputs, and securely store the user’s password using hashing techniques. Proper input validation and security measures will ensure a robust and secure registration process.
Steps to Complete:
Design the Registration Form:
register.php
) within thepublic/
directory to serve as the registration page.Implement Client-Side Validation:
Handle Form Submission:
register.php
file or another PHP script included via a POST request.users
table to prevent duplicates.Implement Server-Side Validation:
filter_var()
withFILTER_VALIDATE_EMAIL
.Hash the Password:
password_hash()
function to securely hash the user’s password before storing it in the database.Insert User Data into the Database:
users
table, ensuring the use of prepared statements to prevent SQL injection.Provide Feedback and Redirection:
Test the Registration Process:
Acceptance Criteria:
password_hash()
function before being stored in the database.The text was updated successfully, but these errors were encountered: