Documentation ¶
Index ¶
- Constants
- Variables
- func AdminSignupHandle(c *fiber.Ctx) error
- func ChangePasswordHandler(c *fiber.Ctx) error
- func CheckAdminHandler(c *fiber.Ctx) error
- func ForgetPasswordFormHandler(c *fiber.Ctx) error
- func ForgetPasswordPageHandler(c *fiber.Ctx) error
- func LoginAdminHandler(c *fiber.Ctx) error
- func LoginGithubHandler(c *fiber.Ctx) error
- func LoginGoogleHandler(c *fiber.Ctx) error
- func LoginPageHandler(c *fiber.Ctx) error
- func LoginTelarHandler(c *fiber.Ctx) error
- func LoginTelarHandlerSPA(c *fiber.Ctx, model *models.LoginModel) error
- func LoginTelarHandlerSSR(c *fiber.Ctx, model *models.LoginModel) error
- func OAuth2Handler(c *fiber.Ctx) error
- func ResetPasswordFormHandler(c *fiber.Ctx) error
- func ResetPasswordPageHandler(c *fiber.Ctx) error
- func SignupPageHandler(c *fiber.Ctx) error
- func SignupTokenHandle(c *fiber.Ctx) error
- func UpdateProfileHandle(c *fiber.Ctx) error
- func VerifySignupHandle(c *fiber.Ctx) error
- func VerifySignupSPA(c *fiber.Ctx, model *models.VerifySignupModel) error
- func VerifySignupSSR(c *fiber.Ctx, model *models.VerifySignupModel) error
- type CreateActionRoomModel
- type HTTPError
- type Organization
- type ProfileResultAsync
- type ProviderAccessToken
- type ResetPasswordClaims
- type TelarSocailClaims
- type TokenModel
- type UpdateProfileQueryModel
- type UserClaim
- type UserInfoInReq
- type UsersLangSettingsResultAsync
Constants ¶
const ( SPAResponseType = "spa" SSRResponseType = "ssr" )
const UpdateAllType = 0
const UpdateGeneralType = 1
const UpdateSocialInfoType = 2
Variables ¶
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 @Tags Admin @Produce json @Security HMAC @Param X-Cloud-Signature header string true "HMAC signature" @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 @Tags Password @Produce json @Success 200 {string} string "OK" @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 @Tags Admin @Produce json @Security HMAC @Param X-Cloud-Signature header string true "HMAC signature" @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 @Tags Password @Produce html @Success 200 {string} string "Login page HTML" @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 @Tags Password @Produce html @Success 200 {string} string "Login page HTML" @Router /password/forget [get]
func LoginAdminHandler ¶
func LoginAdminHandler(c *fiber.Ctx) error
LoginAdminHandler creates a handler for logging in telar social @Summary Admin login @Description Logs in an admin user to the telar social platform @Tags admin @Accept json @Produce json @Param body body models.LoginModel true "Login model" @Success 200 {object} object{token=string} @Failure 400 {object} utils.TelarError "Bad request" @Failure 500 {object} utils.TelarError "Internal server error" @Router /admin/login [post]
func LoginGithubHandler ¶
func LoginGithubHandler(c *fiber.Ctx) error
LoginGithubHandler creates a handler for logging in github @Summary Login with GitHub @Description Redirects the user to GitHub for authentication @Tags Login @Produce json @Success 307 {string} string "Redirect to GitHub" @Router /login/github [get]
func LoginGoogleHandler ¶
func LoginGoogleHandler(c *fiber.Ctx) error
LoginGoogleHandler makes a handler for OAuth 2.0 redirects @Summary Login with Google @Description Redirects the user to Google for authentication @Tags Login @Produce json @Success 307 {string} string "Redirect to Google" @Router /login/google [get]
func LoginPageHandler ¶
func LoginPageHandler(c *fiber.Ctx) error
LoginPageHandler creates a handler for logging in @Summary Login page @Description Renders the login page for Telar Social @Tags Login @Produce html @Success 200 {string} string "Login page HTML" @Router /login [get]
func LoginTelarHandler ¶
func LoginTelarHandler(c *fiber.Ctx) error
LoginTelarHandler creates a handler for logging in telar social @Summary Login with Telar Social @Description Authenticates a user with Telar Social credentials @Tags Login @Accept application/x-www-form-urlencoded @Produce json @Param username formData string true "Username" @Param password formData string true "Password" @Param responseType formData string false "Response Type" @Param state formData string false "State" @Success 200 {object} object{user=models.UserProfileModel,accessToken=string,redirect=string} "User profile and access token" @Failure 400 {object} utils.TelarError "Bad request" @Failure 500 {object} utils.TelarError "Internal server error" @Router /login [post]
func LoginTelarHandlerSPA ¶
func LoginTelarHandlerSPA(c *fiber.Ctx, model *models.LoginModel) error
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 @Summary OAuth 2.0 Redirect Handler @Description Handles OAuth 2.0 redirects and exchanges authorization code for access token @Tags Login @Produce json @Param code query string true "Authorization code" @Param state query string true "State parameter" @Success 200 {object} object{URL=string} "User profile and access token" @Failure 400 {object} utils.TelarError "Bad request" @Failure 500 {object} utils.TelarError "Internal server error" @Router /oauth2/authorized [get]
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 @Tags Password @Produce json @Param verifyId path string true "The verify id that sent to user" @Success 200 {string} string "OK" @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 @Tags Password @Produce html @Param verifyId path string true "The verify id that sent to user" @Success 200 {string} string "Login page 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 @Tags Admin @Produce html @Success 200 {string} string "Signup page" @Router /admin/signup [get]
func SignupTokenHandle ¶
func SignupTokenHandle(c *fiber.Ctx) error
SignupTokenHandle godoc @Summary Sign up token generation @Description Handles the generation of a signup token for email or phone verification. @Tags Signup @Accept multipart/form-data @Produce json @Param fullName formData string true "Full name of the user" @Param email formData string true "Email address of the user" @Param newPassword formData string true "Password for the new user account" @Param verifyType formData string true "Type of verification (email or phone)" @Param g-recaptcha-response formData string true "Google reCAPTCHA response token" @Param responseType formData string false "Response type indicating the desired response format (default or spa)" @Success 200 {object} utils.TelarError "Returns a JSON object containing the generated token if responseType is 'spa', or renders a verification page otherwise." @Failure 400 {object} utils.TelarError "Returns a JSON object describing the missing or invalid parameters." @Failure 500 {object} utils.TelarError "Returns a JSON object indicating an internal server error, such as failure to create a user or verify captcha." @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 @Tags Signup @Accept mpfd @Param code formData string true "6 digits code" minLength(6) maxLength(6) @Param verificaitonSecret formData string true "JWT token" @Param responseType formData string true "Type of response for SPA/SSR" 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 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 UsersLangSettingsResultAsync ¶
type UsersLangSettingsResultAsync struct { Error error // contains filtered or unexported fields }