Skip to content

feat(api): Implement authentication and user management #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 27, 2024

Conversation

nfebe
Copy link
Contributor

@nfebe nfebe commented Nov 24, 2024

  • Added notification service for email notifications
  • Implemented registration, login, and forgot password functionality
  • Enhanced User model to support username and phone number for login
  • Created generic mailer used by the notification service
  • Added user seeder to populate test users
  • Created events, listeners, and mailer for user registration
  • Updated migrations to include phone and username in the users table
  • Created a new migration for verification codes
  • Added middleware to ensure JSON request body format

Resolves trakli/trakli#6

@nfebe nfebe requested a review from aanorbel November 24, 2024 20:54
@nfebe nfebe force-pushed the feat/6/authentication branch 6 times, most recently from 7463100 to bd6b13a Compare November 24, 2024 21:50
Running `composer openapi:test` would lead to `composer openapi` being called or at
would do something equivalent to what the latter does.

Additionally, running `composer openapi` generates the updated documentation so,
if it is first run on the test before `composer openapi:test` it would never catch, when
a developer has not generated documentation.

Signed-off-by: nfebe <fenn25.fn@gmail.com>
Signed-off-by: nfebe <fenn25.fn@gmail.com>
@nfebe nfebe force-pushed the feat/6/authentication branch 2 times, most recently from e7f1961 to d0b5054 Compare November 24, 2024 22:49
Copy link
Contributor Author

@nfebe nfebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to fix the openapi doc generation or the composer script something weird is going on with one of them.

@nfebe nfebe force-pushed the feat/6/authentication branch 2 times, most recently from d04198a to c430ae1 Compare November 24, 2024 22:56
Copy link
Collaborator

@aanorbel aanorbel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

'last_name' => 'string|max:255',
'username' => 'string|max:255',
'phone' => 'string|max:255',
'password' => 'required|string|min:8',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add better constraints

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last_name, username and phone are optional.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was thinking of password constraints. We can change that at any time.

@nfebe nfebe force-pushed the feat/6/authentication branch from c430ae1 to 5f46f19 Compare November 27, 2024 02:23
…n system

- Added notification service to handle email notifications.
- Created GenericMail mailable for email communication with support for dynamic content.
- Implemented registration, login, and forgot password functionality in AuthController.
- Enhanced User model to support username and phone number for login.
- Created events and listeners for user registration (UserRegisteredEvent, UserRegistered listener).
- Added user seeder to populate test users (UserSeeder).
- Updated migrations to include phone number and username in the users table.
- Created a new migration for verification codes (create_verification_codes_table).
- Added middleware to ensure requests have a JSON body (EnsureRequestBodyIsJson).
- Updated Kernel.php to register the new middleware.
- Added route definitions for new authentication endpoints (api.php, web.php).
- Created unit and feature tests for authentication and password reset functionality.
- Removed unused tests (ExampleTest.php).
- Updated UserFactory to generate test users with username and phone number.
- Created view for email templates (resources/views/emails/generic.blade.php).

Signed-off-by: nfebe <opensource@nfebe.com>
Signed-off-by: nfebe <fenn25.fn@gmail.com>
@nfebe nfebe force-pushed the feat/6/authentication branch from 5f46f19 to 17b20e3 Compare November 27, 2024 02:32
@nfebe nfebe requested a review from aanorbel November 27, 2024 02:33
Copy link
Collaborator

@aanorbel aanorbel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐳 🚀

@nfebe nfebe merged commit cd9365f into main Nov 27, 2024
1 check passed
@nfebe nfebe deleted the feat/6/authentication branch November 27, 2024 10:01
@nfebe nfebe mentioned this pull request Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement authentication
2 participants