Class

AuthController

AuthController()

Authentication controller handling login, profile, and session endpoints.

Constructor

# new AuthController()

View Source controllers/auth.controller.js, line 10

Methods

# async static changeAvatar(req, res) → {Promise.<void>}

Update the authenticated user's avatar.

Parameters:
Name Type Description
req IChangeAvatarPayload

Express request with avatar payload.

res Response

Express response instance.

View Source controllers/auth.controller.js, line 134

Resolves when the response has been sent.

Promise.<void>

# async static changePassword(req, res) → {Promise.<void>}

Change the authenticated user's password.

Parameters:
Name Type Description
req IChangePasswordPayload

Express request containing the user context and payload.

res Response

Express response instance.

View Source controllers/auth.controller.js, line 57

Resolves when the response has been sent.

Promise.<void>

# async static getCurrentUser(req, res) → {Promise.<void>}

Retrieve the currently authenticated user's profile.

Parameters:
Name Type Description
req IChangePasswordPayload

Express request with authenticated user.

res Response

Express response instance.

View Source controllers/auth.controller.js, line 98

Resolves when the response has been sent.

Promise.<void>

# async static login(req, res) → {Promise.<void>}

Handle login and issue access/refresh tokens.

Parameters:
Name Type Description
req IGenericBodyResponse.<ILoginDto>

Express request with login credentials.

res Response

Express response instance.

View Source controllers/auth.controller.js, line 17

Resolves when the response has been sent.

Promise.<void>

# async static logout(req, res) → {Promise.<void>}

Clear refresh token cookies and invalidate the session.

Parameters:
Name Type Description
req IAuthRequest

Express request.

res Response

Express response instance.

View Source controllers/auth.controller.js, line 239

Resolves when the response has been sent.

Promise.<void>

# async static refreshToken(req, res) → {Promise.<void>}

Exchange a refresh token for a new access token.

Parameters:
Name Type Description
req IRefreshTokenPayload

Express request with cookie header.

res Response

Express response instance.

View Source controllers/auth.controller.js, line 203

Resolves when the response has been sent.

Promise.<void>

# async static updateOwnName(req, res) → {Promise.<void>}

Update the authenticated user's name.

Parameters:
Name Type Description
req IUpdateNamePayload

Express request containing new name.

res Response

Express response instance.

View Source controllers/auth.controller.js, line 275

Resolves when the response has been sent.

Promise.<void>