handlers

package
v0.0.0-...-58afb8c Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SPAResponseType = "spa"
	SSRResponseType = "ssr"
)
View Source
const UpdateAllType = 0
View Source
const UpdateGeneralType = 1
View Source
const UpdateSocialInfoType = 2

Variables

View Source
var NotFoundHTTPStatusError = errors.New("NotFoundHTTPStatusError")

Functions

func AdminSignupHandle

func AdminSignupHandle(c *fiber.Ctx) error

AdminSignupHandle godoc @Summary signup the admin user @Description signup the admin user and return access token @Produce json @Success 200 {object} object{token=string} @Failure 400 {object} utils.TelarError @Failure 404 {object} utils.TelarError @Failure 500 {object} utils.TelarError @Router /admin/signup [post]

func ChangePasswordHandler

func ChangePasswordHandler(c *fiber.Ctx) error

ChangePasswordHandler godoc @Summary change user password @Description change user password @Produce json @Success 200 {object} object{} @Failure 400 {object} utils.TelarError @Failure 404 {object} utils.TelarError @Failure 500 {object} utils.TelarError @Router /password/change [post]

func CheckAdminHandler

func CheckAdminHandler(c *fiber.Ctx) error

CheckAdminHandler godoc @Summary whether admin user registered @Description handler to check whether admin user registered @Produce json @Success 200 {object} object{admin=bool} @Failure 400 {object} utils.TelarError @Failure 404 {object} utils.TelarError @Failure 500 {object} utils.TelarError @Router /admin/check [post]

func ForgetPasswordFormHandler

func ForgetPasswordFormHandler(c *fiber.Ctx) error

ForgetPasswordFormHandler godoc @Summary send forget password email @Description send forget password link to the user email @Produce json @Success 200 {object} object{} @Failure 400 {object} utils.TelarError @Failure 404 {object} utils.TelarError @Failure 500 {object} utils.TelarError @Router /password/forget [post]

func ForgetPasswordPageHandler

func ForgetPasswordPageHandler(c *fiber.Ctx) error

ForgetPasswordPageHandler godoc @Summary return forget password page @Description return forget password page @Produce html @Router /password/forget [get]

func LoginAdminHandler

func LoginAdminHandler(c *fiber.Ctx) error

LoginAdminHandler creates a handler for logging in telar social

func LoginGithubHandler

func LoginGithubHandler(c *fiber.Ctx) error

LoginGithubHandler creates a handler for logging in github

func LoginGoogleHandler

func LoginGoogleHandler(c *fiber.Ctx) error

LoginGoogleHandler makes a handler for OAuth 2.0 redirects

func LoginPageHandler

func LoginPageHandler(c *fiber.Ctx) error

LoginPageHandler creates a handler for logging in

func LoginTelarHandler

func LoginTelarHandler(c *fiber.Ctx) error

LoginTelarHandler creates a handler for logging in telar social

func LoginTelarHandlerSPA

func LoginTelarHandlerSPA(c *fiber.Ctx, model *models.LoginModel) error

LoginTelarHandlerSPA creates a handler for logging in telar social

func LoginTelarHandlerSSR

func LoginTelarHandlerSSR(c *fiber.Ctx, model *models.LoginModel) error

LoginTelarHandlerSSR creates a handler for logging in telar social

func OAuth2Handler

func OAuth2Handler(c *fiber.Ctx) error

OAuth2Handler makes a handler for OAuth 2.0 redirects

func ResetPasswordFormHandler

func ResetPasswordFormHandler(c *fiber.Ctx) error

ResetPasswordFormHandler godoc @Summary reset user password @Description get a password from user and set as a new password @Produce json @Success 200 {object} object{} @Failure 400 {object} utils.TelarError @Failure 404 {object} utils.TelarError @Failure 500 {object} utils.TelarError @Router /password/reset/{verifyId} [post]

func ResetPasswordPageHandler

func ResetPasswordPageHandler(c *fiber.Ctx) error

ResetPasswordPageHandler godoc @Summary return reset password page @Description return reset password page @Produce html @Router /password/reset/{verifyId} [get]

func SignupPageHandler

func SignupPageHandler(c *fiber.Ctx) error

SignupPageHandler godoc @Summary return signup page @Description return signup page in HTML @Produce html @Router /admin/signup [get]

func SignupTokenHandle

func SignupTokenHandle(c *fiber.Ctx) error

SignupTokenHandle godoc @Summary create a signup token @Description return a token to verify user signup process @Produce json @Success 200 {object} object{token=string} @Failure 400 {object} utils.TelarError @Failure 404 {object} utils.TelarError @Failure 500 {object} utils.TelarError @Router /signup [post]

func UpdateProfileHandle

func UpdateProfileHandle(c *fiber.Ctx) error

UpdateProfileHandle a function invocation

func VerifySignupHandle

func VerifySignupHandle(c *fiber.Ctx) error

VerifySignupHandle godoc @Summary verify signup token @Description handler verify the signup token to register user @Accept mpfd @Param code formData string true "6 digits code" example(123749) minimum(6) maximum(6) @Param verificaitonSecret formData string true "JWT token" example(eyJhbGcIUzI1.eyJpL.yRQYzs) @Param responseType formData string true "Type of response for SPA/SSR" example(spa) Enums(spa,ssr) @Success 200 {object} object{} @Failure 400 {object} utils.TelarError @Failure 404 {object} utils.TelarError @Failure 500 {object} utils.TelarError @Router /signup/verify [post]

func VerifySignupSPA

func VerifySignupSPA(c *fiber.Ctx, model *models.VerifySignupModel) error

func VerifySignupSSR

func VerifySignupSSR(c *fiber.Ctx, model *models.VerifySignupModel) error

Types

type CreateActionRoomModel

type CreateActionRoomModel struct {
	ObjectId    uuid.UUID `json:"objectId"`
	OwnerUserId uuid.UUID `json:"ownerUserId"`
	PrivateKey  string    `json:"privateKey"`
	AccessKey   string    `json:"accessKey"`
	Status      int       `json:"status"`
	CreatedDate int64     `json:"created_date"`
}

type HTTPError

type HTTPError struct {
	Error utils.ErrorCodeMessage `json:"error"`
}

type Organization

type Organization struct {
	Login string `json:"login"`
}

type ProfileResultAsync

type ProfileResultAsync struct {
	Profile *models.UserProfileModel
	Error   error
}

type ProviderAccessToken

type ProviderAccessToken struct {
	AccessToken string `json:"access_token"`
}

ProviderAccessToken as issued by GitHub or GitLab

type ResetPasswordClaims

type ResetPasswordClaims struct {
	VerifyId string `json:"verifyId"`
	jwt.StandardClaims
}

type TelarSocailClaims

type TelarSocailClaims struct {
	// Name is the full name of the user for OIDC
	Name string `json:"name"`

	// AccessToken for use with the GitHub Profile API
	AccessToken string `json:"access_token"`

	// String with all organizations separated with commas
	Organizations string `json:"organizations"`

	// User information
	Claim UserClaim `json:"claim"`

	// Inherit from standard claims
	jwt.StandardClaims
}

TelarSocailClaims extends standard claims

type TokenModel

type TokenModel struct {
	// contains filtered or unexported fields
}

type UpdateProfileQueryModel

type UpdateProfileQueryModel struct {
	UpdateType int `query:"updateType"`
}

type UserClaim

type UserClaim struct {
	DisplayName   string `json:"displayName"`
	SocialName    string `json:"socialName"`
	Organizations string `json:"organizations"`
	Avatar        string `json:"avatar"`
	Banner        string `json:"banner"`
	TagLine       string `json:"tagLine"`
	UserId        string `json:"uid"`
	Email         string `json:"email"`
	CreatedDate   int64  `json:"createdDate"`
	Role          string `json:"role"`
}

User information claim

type UserInfoInReq

type UserInfoInReq struct {
	UserId      uuid.UUID `json:"userId"`
	Username    string    `json:"username"`
	Avatar      string    `json:"avatar"`
	DisplayName string    `json:"displayName"`
	SystemRole  string    `json:"systemRole"`
}

type UsersLangSettingsResultAsync

type UsersLangSettingsResultAsync struct {
	Error error
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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