Documentation ¶
Overview ¶
Package controller contains all the controllers of the application
Index ¶
- func Activate2FA(c *gin.Context)
- func CreateBackup2FA(c *gin.Context)
- func CreateUserAuth(c *gin.Context)
- func CreateVerificationEmail(c *gin.Context)
- func Deactivate2FA(c *gin.Context)
- func GetUnverifiedEmail(c *gin.Context)
- func Login(c *gin.Context)
- func Logout(c *gin.Context)
- func PasswordForgot(c *gin.Context)
- func PasswordRecover(c *gin.Context)
- func PasswordUpdate(c *gin.Context)
- func Refresh(c *gin.Context)
- func ResendVerificationCodeToModifyActiveEmail(c *gin.Context)
- func Setup2FA(c *gin.Context)
- func UpdateEmail(c *gin.Context)
- func Validate2FA(c *gin.Context)
- func ValidateBackup2FA(c *gin.Context)
- func VerifyEmail(c *gin.Context)
- func VerifyUpdatedEmail(c *gin.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Activate2FA ¶ added in v1.6.1
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
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 ¶
CreateUserAuth - register a new user account
[POST]: /register
dependency: relational database
Accepted JSON payload:
`{"email":"...", "password":"..."}`
func CreateVerificationEmail ¶ added in v1.6.1
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
Deactivate2FA - disable 2FA for user account
dependency: relational database, JWT, 2FA service
Accepted JSON payload:
`{"password":"..."}`
func GetUnverifiedEmail ¶ added in v1.6.19
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 ¶
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
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
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
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
PasswordUpdate - change password in logged-in state
dependency: relational database, JWT
Accepted JSON payload:
`{"password":"...", "passNew":"...", "passRepeat":"..."}`
func ResendVerificationCodeToModifyActiveEmail ¶ added in v1.6.19
ResendVerificationCodeToModifyActiveEmail issues new verification code upon request
dependency: email service, email verification service, Redis, relational database, JWT
func Setup2FA ¶ added in v1.6.1
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
UpdateEmail - update existing user email
dependency: relational database, JWT
Accepted JSON payload:
`{"emailNew":"...", "password":"..."}`
func Validate2FA ¶ added in v1.6.1
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
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
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
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.