accounts

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2018 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOOKUP_TYPE_USERNAME
	LOOKUP_TYPE_OAUTH
)
View Source
const PASSWORD_MAX_LENGTH int = 32
View Source
const PASSWORD_MIN_LENGTH int = 6

Variables

View Source
var OAUTH_ALLOWED_DESTINATIONS = []string{"oauth-action/login", "oauth-action/register"}
View Source
var OAUTH_ALLOWED_PROVIDERS = []string{"google", "facebook", "clever"}
View Source
var OAUTH_ALLOWED_REQUESTS = []string{"userinfo"}

Functions

func ActivateUser

func ActivateUser(c context.Context, userRecord *datastore.UserRecord) error

func CreateSubaccountRequest

func CreateSubaccountRequest(rData *pages.RequestData)

func DoRegister

func DoRegister(rData *pages.RequestData, info *RegisterInfo) error

func ForgotPasswordByUsername

func ForgotPasswordByUsername(rData *pages.RequestData)

func GetFullNameShortened

func GetFullNameShortened(userData *datastore.UserData) string

func GetUserInfosMap

func GetUserInfosMap(rData *pages.RequestData, ids []int64) (map[int64]*PublicAccountInfo, error)

func GetUserRecordViaKey

func GetUserRecordViaKey(c context.Context, keyVal interface{}) (*datastore.UserRecord, error)

Also differentiates between a "record not found", which will return a null record, and a proper technical error which returns error

func GetUserRecordViaUsername

func GetUserRecordViaUsername(c context.Context, username string) (*datastore.UserRecord, error)

Differentiates between a "record not found", which will return a null record, and a proper technical error which returns error

func GetUserRecordsMap

func GetUserRecordsMap(rData *pages.RequestData, ids []int64) (map[int64]*datastore.UserRecord, error)

func GetUsernamesForIds

func GetUsernamesForIds(rData *pages.RequestData, userIds []int64) (map[int64][]string, error)

func GotActivateRequest

func GotActivateRequest(rData *pages.RequestData)

func GotAvatarBase64ChangeServiceRequest

func GotAvatarBase64ChangeServiceRequest(rData *pages.RequestData)

func GotAvatarFileChangeServiceRequest

func GotAvatarFileChangeServiceRequest(rData *pages.RequestData)

func GotChangePasswordActionRequest

func GotChangePasswordActionRequest(rData *pages.RequestData)

func GotChangePasswordTokenRequestBySession

func GotChangePasswordTokenRequestBySession(rData *pages.RequestData)

func GotEmailChangeActionRequest

func GotEmailChangeActionRequest(rData *pages.RequestData)

func GotEmailChangeTokenRequest

func GotEmailChangeTokenRequest(rData *pages.RequestData)

func GotLoginServiceRequest

func GotLoginServiceRequest(rData *pages.RequestData)

func GotNameChangeServiceRequest

func GotNameChangeServiceRequest(rData *pages.RequestData)

func GotRefreshTokenRequest

func GotRefreshTokenRequest(rData *pages.RequestData)

func GotRegisterServiceRequest

func GotRegisterServiceRequest(rData *pages.RequestData)

func GotSettingsInfoServiceRequest

func GotSettingsInfoServiceRequest(rData *pages.RequestData)

func OauthAction

func OauthAction(rData *pages.RequestData)

func OauthRequest

func OauthRequest(rData *pages.RequestData)

func OauthResponse

func OauthResponse(rData *pages.RequestData)

func RemoveFromSearch

func RemoveFromSearch(c context.Context, userID string) error

func SendActivateTokenRequest

func SendActivateTokenRequest(rData *pages.RequestData)

func SubaccountsList

func SubaccountsList(rData *pages.RequestData)

func UpdateAvatar

func UpdateAvatar(rData *pages.RequestData, srcImage image.Image, userRecord *datastore.UserRecord) error

Types

type FacebookPicture

type FacebookPicture struct {
	Data FacebookPictureData `json:"data"`
}

type FacebookPictureData

type FacebookPictureData struct {
	Url string `json:"url"`
}

type FacebookUser

type FacebookUser struct {
	Id            string          `json:"id"`
	Email         string          `json:"email"`
	FirstName     string          `json:"first_name"`
	LastName      string          `json:"last_name"`
	AvatarPicture FacebookPicture `json:"picture"`
}

type LoginRequestMeta

type LoginRequestMeta struct {
	Audience  string `json:"aud"`
	AppId     string `json:"appId"`
	AppName   string `json:"appName"`
	AppScheme string `json:"appScheme"`
	AppPort   string `json:"appPort"`
}

type OAuthUserInfo added in v1.2.0

type OAuthUserInfo struct {
	Id        string `json:"uid,omitempty" datastore:",noindex"`
	Email     string `json:"email,omitempty" datastore:",noindex"`
	FirstName string `json:"fname,omitempty" datastore:",noindex"`
	LastName  string `json:"lname,omitempty" datastore:",noindex"`
	AvatarURL string `json:"aurl,omitempty" datastore:",noindex"`
}

type PublicAccountInfo

type PublicAccountInfo struct {
	Id          string `json:"uid"`
	DisplayName string `json:"dname"`
	AvatarId    string `json:"avid"`
}

func GetUserInfo

func GetUserInfo(userRecord *datastore.UserRecord) *PublicAccountInfo

func GetUserInfosList

func GetUserInfosList(rData *pages.RequestData, ids []int64) ([]*PublicAccountInfo, error)

type RegisterInfo

type RegisterInfo struct {
	Terms      bool
	Newsletter bool

	Username     string
	EmailAddress string
	FirstName    string
	LastName     string
	Password     string
	ParentId     int64

	AppId   string
	AppPort string

	AvatarUrl  string
	LookupType int64 //only used if subaccounts are allowed
}

type RegisterRequestMeta

type RegisterRequestMeta struct {
	Audience   string `json:"aud"`
	Terms      bool   `json:"terms"`
	Newsletter bool   `json:"newsletter"`
	AppId      string `json:"appId"`
	AppName    string `json:"appName"`
	AppScheme  string `json:"appScheme"`
	AppPort    string `json:"appPort"`
}

type StateInfo

type StateInfo struct {
	Destination string `json:"dest"`
	Request     string `json:"request"`
	RequestMeta string `json:"requestMeta,omitempty" datastore:",noindex"`
	Scheme      string `json:"scheme"`
	Provider    string `json:"provider"`
	Response    string `json:"response,omitempty" datastore:",noindex"`
}

func (*StateInfo) DestinationUrl

func (s *StateInfo) DestinationUrl(rData *pages.RequestData, jwtRecord *datastore.JwtRecord) (string, error)

func (*StateInfo) ErrorUrl

func (s *StateInfo) ErrorUrl(statusCode string) string

func (*StateInfo) ResponseUrl

func (s *StateInfo) ResponseUrl(hostname string) string

type SubAccountInfo

type SubAccountInfo struct {
	PublicAccountInfo
	Username string `json:"uname"`
}

type UserInfo

type UserInfo struct {
	Id          string `json:"uid"`
	Email       string `json:"email"`
	FirstName   string `json:"fname"`
	LastName    string `json:"lname"`
	DisplayName string `json:"dname"`
	AvatarId    string `json:"avid"`
	Jwt         string `json:"jwt"`
	ErrorCode   string `json:"code"`
}

func DoLogin

func DoLogin(rData *pages.RequestData, username string, password string, audience string, lookupType int64) (*datastore.UserRecord, *UserInfo, *datastore.JwtRecord, string, error)

func GetUserInfoFromRecord added in v1.2.0

func GetUserInfoFromRecord(userRecord *datastore.UserRecord) *UserInfo

func (*UserInfo) GetString added in v1.2.0

func (u *UserInfo) GetString() (string, error)

func (*UserInfo) SetErrorCode added in v1.2.0

func (u *UserInfo) SetErrorCode(code string)

func (*UserInfo) SetJwt added in v1.2.0

func (u *UserInfo) SetJwt(jwt string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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