Add 2fa for authentification #383
|
@ -28,6 +28,7 @@ import (
|
|||
"net/http"
|
||||
)
|
||||
|
||||
// UserTOTPEnroll is the handler to enroll a user into totp
|
||||
func UserTOTPEnroll(c echo.Context) error {
|
||||
u, err := user.GetCurrentUser(c)
|
||||
if err != nil {
|
||||
|
@ -42,6 +43,7 @@ func UserTOTPEnroll(c echo.Context) error {
|
|||
return c.JSON(http.StatusOK, t)
|
||||
}
|
||||
|
||||
// UserTOTPEnable is the handler to enable totp for a user
|
||||
func UserTOTPEnable(c echo.Context) error {
|
||||
u, err := user.GetCurrentUser(c)
|
||||
if err != nil {
|
||||
|
@ -67,6 +69,7 @@ func UserTOTPEnable(c echo.Context) error {
|
|||
return c.JSON(http.StatusOK, models.Message{Message: "TOTP was enabled successfully."})
|
||||
}
|
||||
|
||||
// UserTOTPQrCode is the handler to show a qr code to enroll the user into totp
|
||||
func UserTOTPQrCode(c echo.Context) error {
|
||||
u, err := user.GetCurrentUser(c)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue