videoflix-frontend - v0.0.0
    Preparing search index...

    Authentication service.

    Manages all authentication and user-related operations such as:

    • Login / Signup / Logout
    • Password reset flows
    • Fetching and storing user profiles
    • Managing user session persistence in localStorage
    • Handling user favorites and email validation

    All API calls are handled through Angular's HttpClient with error handling delegated to ErrorService.

    Index

    Constructors

    Properties

    allUserEmails: Signal<string[]> = ...
    currentUser: Signal<User | null> = ...

    Methods

    • Automatically logs in a user if valid data is found in localStorage.

      Searches for both "user" and "rememberMe" entries.

      Returns void

    • Fetches all user profiles from the backend.

      Returns Observable<[]>

      Observable of user profile data.

    • Initiates a password reset email for the specified address.

      Parameters

      • email: string

        User email for password reset.

      Returns Observable<Object>

      Observable of the backend response.

    • Retrieves the current user from localStorage (if available).

      Returns User | null

      The user object or null if not logged in.

    • Returns the current user's authentication token.

      Returns string

      JWT token string or an empty string if not logged in.

    • Checks if a user session is currently active.

      Returns boolean

      true if a user is logged in, otherwise false.

    • Loads all registered user emails from the backend. Used mainly for async email validation during signup and forgot-password flows.

      Returns Observable<[]>

      Observable stream of users.

    • Logs in a user with the provided credentials.

      Parameters

      • email: string

        User's email address.

      • password: string

        User's password.

      Returns Observable<User>

      Observable emitting a User object on success.

    • Completes the password reset process with provided credentials.

      Parameters

      • uid: string

        User ID from reset link.

      • token: string

        Reset token.

      • newPassword: string

        The new password to set.

      Returns Observable<Object>

      Observable of the backend response.

    • Registers a new user.

      Parameters

      • email: string

        User email.

      • password: string

        User password.

      • confirmPassword: string

        Confirmation password.

      Returns Observable<User>

      Observable emitting a new User on success.

    • Updates the user's list of favorite videos both locally and in storage.

      Parameters

      • favoriteVideos: number[]

        Array of favorite video IDs.

      Returns void