JiayangYing / CITS3403_PRO

MIT License
2 stars 0 forks source link

Implement User Registration Function #27

Closed JiayangYing closed 4 months ago

JiayangYing commented 4 months ago

Description: We need to develop a user registration functionality that will manage user creation and handle data persistence in a database. The User object should consist of the following attributes:

ID (Primary Key): A unique identifier for each user.
FirstName: The user's first name.
LastName: The user's last name.
EmailAddress: The user's email address. This should be validated to ensure it follows the correct email format.
IsSeller: A boolean indicating if the user is a seller.
IsActive: A boolean to show if the user's account is active. An account should be deactivated if the admin chooses to do so or if the user enters an incorrect password more than five times.
PostCode: The user’s postal code.
Password: The user's password. This should be stored securely.
CreatedOn: The date and time when the account was created.

Requirements:

Ensure that the email address is validated before storing it in the database.
Implement logic to handle the activation and deactivation of user accounts based on specified conditions.
Securely store the password, preferably using hashing.

Output:

Successfully register a user with all the above fields.
Store the user's information in a database following the successful validation of input data.

Notes:

using SQLAlchemy for database operations.
Include error handling to manage input validation failures and database errors effectively.