Add 2fa for authentification #383

Merged
konrad merged 10 commits from feature/2fa into master 2020-04-17 19:25:37 +00:00
1 changed files with 3 additions and 0 deletions
Showing only changes of commit c7c570d6e7 - Show all commits

View File

@ -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 {