account

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitGoogleOauth

func InitGoogleOauth()

InitGoogleOauth init google oauth

func SignUp added in v1.1.0

func SignUp(request *CreateAccountRequest) (int, *data.APIResponse, string, time.Time)

SignUp internal

Types

type API

type API struct{}

API api endpoints

func (API) GoogleCallback

func (API) GoogleCallback(c *gin.Context)

GoogleCallback handle google callback

func (API) GoogleLogin

func (API) GoogleLogin(c *gin.Context)

GoogleLogin google login request

func (API) Login

func (API) Login(c *gin.Context)

Login request

func (API) Logout

func (API) Logout(c *gin.Context)

Logout logout

func (API) SignUp

func (API) SignUp(c *gin.Context)

SignUp request

func (API) UpdatePassword

func (API) UpdatePassword(c *gin.Context)

UpdatePassword api

type CreateAccountRequest

type CreateAccountRequest struct {
	Email           string `json:"email" xml:"email" form:"email" binding:"required"`
	Username        string `json:"username" xml:"username" form:"username" binding:"required"`
	Password        string `json:"password" xml:"password" form:"password" binding:"required"`
	ConfirmPassword string `json:"confirmPassword" xml:"confirmPassword" form:"confirmPassword" binding:"required"`
}

CreateAccountRequest /signup

type GoogleUserInfo

type GoogleUserInfo struct {
	ID            string `json:"id"`
	FamilyName    string `json:"family_name"`
	Name          string `json:"name"`
	Picture       string `json:"picture"`
	Local         string `json:"local"`
	Email         string `json:"Email"`
	GivenName     string `json:"GivenName"`
	VerifiedEmail bool   `json:"verified_email"`
}

GoogleUserInfo user info

type JWTClaim

type JWTClaim struct {
	ImageURL string `json:"image_url"`
	jwt.StandardClaims
}

JWTClaim web claim

func GetClaimFromCookieAndRenew

func GetClaimFromCookieAndRenew(c *gin.Context) (*JWTClaim, error)

GetClaimFromCookieAndRenew get claim and renew

func GetClaimFromHeaderAndRenew

func GetClaimFromHeaderAndRenew(c *gin.Context) (*JWTClaim, error)

GetClaimFromHeaderAndRenew get claim and renew. Since auth token is httponly, it will not really be able to get from javascript

func GetClaimInContext

func GetClaimInContext(contextKey map[string]interface{}) *JWTClaim

GetClaimInContext get claim struct from context

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email" xml:"email" form:"email" binding:"required"`
	Password string `json:"password" xml:"password" form:"password" binding:"required"`
}

LoginRequest login request

type Page

type Page struct{}

Page account page

func (Page) Account

func (Page) Account(c *gin.Context)

Account /account requires claim

func (Page) Login

func (Page) Login(c *gin.Context)

Login /login

func (Page) Signup

func (Page) Signup(c *gin.Context)

Signup /signup

type PageData

type PageData struct {
	HasPassword bool
}

PageData /account

type UpdatePasswordRequest

type UpdatePasswordRequest struct {
	CurrentPassword string `json:"currentPassword" xml:"currentPassword" form:"currentPassword" binding:"required"`
	Password        string `json:"password" xml:"password" form:"password" binding:"required"`
	ConfirmPassword string `json:"confirmPassword" xml:"confirmPassword" form:"confirmPassword" binding:"required"`
}

UpdatePasswordRequest /api/account/update/password

Jump to

Keyboard shortcuts

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