controller

package
v1.6.35 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 11 Imported by: 2

Documentation

Overview

Package controller contains all the controllers of the application

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Activate2FA added in v1.6.1

func Activate2FA(c *gin.Context)

Activate2FA - activate 2FA upon validation

- possible for accounts without 2FA-ON

dependency: relational database, JWT, 2FA service

Accepted JSON payload:

`{"otp":"..."}`

func CreateBackup2FA added in v1.6.18

func CreateBackup2FA(c *gin.Context)

CreateBackup2FA - get new set of 2FA backup codes

- 2FA must already be enabled for the user account

dependency: relational database, JWT, 2FA service

Accepted JSON payload:

`{"password":"..."}`

func CreateUserAuth

func CreateUserAuth(c *gin.Context)

CreateUserAuth - register a new user account

[POST]: /register

dependency: relational database

Accepted JSON payload:

`{"email":"...", "password":"..."}`

func CreateVerificationEmail added in v1.6.1

func CreateVerificationEmail(c *gin.Context)

CreateVerificationEmail issues new verification code upon request

dependency: email service, email verification service, Redis

Accepted JSON payload:

`{"email":"...", "password":"..."}`

func Deactivate2FA added in v1.6.1

func Deactivate2FA(c *gin.Context)

Deactivate2FA - disable 2FA for user account

dependency: relational database, JWT, 2FA service

Accepted JSON payload:

`{"password":"..."}`

func GetUnverifiedEmail added in v1.6.19

func GetUnverifiedEmail(c *gin.Context)

GetUnverifiedEmail - if any email is yet to be verified, return it to the logged-in user

When this email is verified, it will replace the existing active email of the user.

dependency: email verification service, relational database, JWT

func Login

func Login(c *gin.Context)

Login - issue new JWTs after user:pass verification

[POST]: /login

dependency: relational database, JWT

Accepted JSON payload:

`{"email":"...", "password":"..."}`

func Logout added in v1.6.9

func Logout(c *gin.Context)

Logout -

- if 'AUTH_COOKIE_ACTIVATE=yes', delete tokens from client browser.

- if Redis is enabled, save invalid tokens in Redis up until the expiry time.

dependency: JWT

func PasswordForgot added in v1.6.1

func PasswordForgot(c *gin.Context)

PasswordForgot sends secret code for resetting a forgotten password

dependency: relational database, Redis, email service, password recovery service

Accepted JSON payload:

`{"email":"..."}`

func PasswordRecover added in v1.6.1

func PasswordRecover(c *gin.Context)

PasswordRecover resets a forgotten password

dependency: relational database, Redis

Accepted JSON payload:

`{"secretCode":"...", "passNew":"...", "passRepeat":"...", "recoveryKey":"..."}`

- `recoveryKey` is required if 2FA is enabled for the user account

func PasswordUpdate added in v1.6.1

func PasswordUpdate(c *gin.Context)

PasswordUpdate - change password in logged-in state

dependency: relational database, JWT

Accepted JSON payload:

`{"password":"...", "passNew":"...", "passRepeat":"..."}`

func Refresh added in v1.2.5

func Refresh(c *gin.Context)

Refresh - issue new JWTs after validation

dependency: JWT

func ResendVerificationCodeToModifyActiveEmail added in v1.6.19

func ResendVerificationCodeToModifyActiveEmail(c *gin.Context)

ResendVerificationCodeToModifyActiveEmail issues new verification code upon request

dependency: email service, email verification service, Redis, relational database, JWT

func Setup2FA added in v1.6.1

func Setup2FA(c *gin.Context)

Setup2FA - get secret to activate 2FA

- possible for accounts without 2FA-ON

dependency: relational database, JWT, 2FA service

Accepted JSON payload:

`{"password":"..."}`

func UpdateEmail added in v1.6.19

func UpdateEmail(c *gin.Context)

UpdateEmail - update existing user email

dependency: relational database, JWT

Accepted JSON payload:

`{"emailNew":"...", "password":"..."}`

func Validate2FA added in v1.6.1

func Validate2FA(c *gin.Context)

Validate2FA - issue new JWTs upon 2FA validation

- required for accounts with 2FA-ON

dependency: relational database, JWT, 2FA service

Accepted JSON payload:

`{"otp":"..."}`

func ValidateBackup2FA added in v1.6.18

func ValidateBackup2FA(c *gin.Context)

ValidateBackup2FA - issue new JWTs upon 2FA validation with backup code

dependency: relational database, JWT, 2FA service

Accepted JSON payload:

`{"otp":"..."}`

func VerifyEmail added in v1.6.1

func VerifyEmail(c *gin.Context)

VerifyEmail - verify email address of a newly registered user account

dependency: email verification service, Redis

Accepted JSON payload:

`{"verificationCode":"..."}`

func VerifyUpdatedEmail added in v1.6.19

func VerifyUpdatedEmail(c *gin.Context)

VerifyUpdatedEmail - verify request to modify user's email address

dependency: email verification service, relational database, redis

Accepted JSON payload:

`{"verificationCode":"..."}`

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL