Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Login ¶
Login - Requests an OTP for authentication This function checks if the phone number is registered. If registered, it generates and sends an OTP via Fonnte API. If the phone number is not found, it returns a 404 error.
func Logout ¶
Logout - Handles user logout by validating and removing the token. This function checks if the Authorization header contains a valid Bearer token. If valid, the server instructs the client to remove the token. Note: The token itself is not stored server-side, so invalidation is handled on the client.
func Register ¶
Register - Handles user registration. This function accepts a JSON request containing username, full name, and phone number. It checks if the username or phone number is already taken. If the user is new, it creates both a User and a Profile in the database. The role is automatically set to "user" (cannot be changed during registration).
Types ¶
This section is empty.