app

package
v0.2.56 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2020 License: MIT Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	/*
	  EXIF Image Orientations
	  1        2       3      4         5            6           7          8

	  888888  888888      88  88      8888888888  88                  88  8888888888
	  88          88      88  88      88  88      88  88          88  88      88  88
	  8888      8888    8888  8888    88          8888888888  8888888888          88
	  88          88      88  88
	  88          88  888888  888888
	*/
	Upright            = 1
	UprightMirrored    = 2
	UpsideDown         = 3
	UpsideDownMirrored = 4
	RotatedCWMirrored  = 5
	RotatedCCW         = 6
	RotatedCCWMirrored = 7
	RotatedCW          = 8

	MaxImageSize                 = 6048 * 4032 // 24 megapixels, roughly 36MB as a raw image
	IMAGE_THUMBNAIL_PIXEL_WIDTH  = 120
	IMAGE_THUMBNAIL_PIXEL_HEIGHT = 100
	IMAGE_PREVIEW_PIXEL_WIDTH    = 1024
)
View Source
const (
	OAUTH_COOKIE_MAX_AGE_SECONDS = 30 * 60 // 30 minutes
	COOKIE_OAUTH                 = "MMOAUTH"
)
View Source
const (
	TOKEN_TYPE_PASSWORD_RECOVERY  = "password_recovery"
	TOKEN_TYPE_VERIFY_EMAIL       = "verify_email"
	TOKEN_TYPE_VERIFY_MOBILE      = "verify_mobile"
	PASSWORD_RECOVER_EXPIRY_TIME  = 1000 * 60 * 60 // 1 hour
	VERIFY_EMAIL_EXPIRY_TIME      = 1000 * 60 * 60 // 1 hour
	IMAGE_PROFILE_PIXEL_DIMENSION = 128
	SMS_COOKIE_MAX_AGE_SECONDS    = 30 * 60 // 30 minutes
	VERIFICATION_CODE             = "verified_code"
	COOKIE_SMS_TOKEN              = "verified_token"
)
View Source
const TIME_TO_WAIT_FOR_CONNECTIONS_TO_CLOSE_ON_SERVER_SHUTDOWN = time.Second

Variables

This section is empty.

Functions

func AuthenticateUserForLogin

func AuthenticateUserForLogin(id, loginId, password string) (*model.User, *model.AppError)

func AuthorizeOAuthUser

func AuthorizeOAuthUser(w http.ResponseWriter, r *http.Request, service, code, state, redirectUri string) (string, io.ReadCloser, *model.AppError)

func CheckIfRolesGrantPermission

func CheckIfRolesGrantPermission(roles []string, permissionId string) bool

func CheckPasswordAndAllCriteria

func CheckPasswordAndAllCriteria(user *model.User, password string) *model.AppError

func CheckUserAdditionalAuthenticationCriteria

func CheckUserAdditionalAuthenticationCriteria(user *model.User) *model.AppError

func CloseBody

func CloseBody(r *http.Response)

func CompleteOAuth

func CompleteOAuth(service string, userData io.ReadCloser) (bool, *model.User, *model.AppError)

func CompleteOAuthMobile

func CompleteOAuthMobile(service string, userData io.ReadCloser, props map[string]string) (*model.User, *model.AppError)

func CreateOAuthMobileUser

func CreateOAuthMobileUser(service string, userData io.Reader) (*model.User, *model.AppError)

func CreateOAuthStateToken

func CreateOAuthStateToken(extra string, props model.StringInterface) (*model.Token, *model.AppError)

func CreateOAuthUser

func CreateOAuthUser(service string, userData io.Reader) (bool, *model.User, *model.AppError)

func CreateProfileImage

func CreateProfileImage(username string, userId string) ([]byte, *model.AppError)

func CreateUser

func CreateUser(user *model.User) (*model.User, *model.AppError)

func CreateUserFromEmailOrMobile

func CreateUserFromEmailOrMobile(user *model.User) (*model.User, *model.AppError)

func CreateVerifyCodeToken

func CreateVerifyCodeToken(mobile, verifiedCode string) (*model.Token, *model.AppError)

func CustomClaimsHasPermissionTo

func CustomClaimsHasPermissionTo(customClaims model.CustomClaims, permission *model.Permission) bool

func DeleteToken

func DeleteToken(token *model.Token) *model.AppError

func DoLogin

func DoLogin(w http.ResponseWriter, r *http.Request, user *model.User, deviceId string) *model.AppError

func GetAuthorizationCode

func GetAuthorizationCode(w http.ResponseWriter, r *http.Request, service string, props map[string]string) (string, *model.AppError)

func GetMd5String

func GetMd5String(s string) string

func GetOAuthLoginEndpoint

func GetOAuthLoginEndpoint(w http.ResponseWriter, r *http.Request, service, action string) (string, *model.AppError)

func GetOAuthStateToken

func GetOAuthStateToken(token string) (*model.Token, *model.AppError)

func GetProfileImage

func GetProfileImage(user *model.User) ([]byte, bool, *model.AppError)

func GetProtocol

func GetProtocol(r *http.Request) string

func GetTokenByExtra

func GetTokenByExtra(extra string) (*model.Token, *model.AppError)

func GetTokenCountByExtra

func GetTokenCountByExtra(extra string) (int64, *model.AppError)

func GetUser

func GetUser(userId string) (*model.User, *model.AppError)

func GetUserByAuth

func GetUserByAuth(authData *string, authService string) (*model.User, *model.AppError)

func GetUserByEmail

func GetUserByEmail(email string) (*model.User, *model.AppError)

func GetUserByMobile

func GetUserByMobile(mobile string) (*model.User, *model.AppError)

func GetUserByUsername

func GetUserByUsername(username string) (*model.User, *model.AppError)

func GetUserForLogin

func GetUserForLogin(loginId string) (*model.User, *model.AppError)

func InitStores

func InitStores()

func IsDoctor

func IsDoctor(userId string) bool

func IsEmailExist

func IsEmailExist(email string) bool

func IsFirstUserAccount

func IsFirstUserAccount() bool

func IsMobileExist

func IsMobileExist(mobile string) bool

func IsUserSignUpAllowed

func IsUserSignUpAllowed() *model.AppError

func IsUsernameTaken

func IsUsernameTaken(name string) bool

func NewServer

func NewServer()

func ReadFile

func ReadFile(path string) ([]byte, *model.AppError)

func ReloadConfig

func ReloadConfig()

func SanitizeProfile

func SanitizeProfile(user *model.User, asAdmin bool)

func SearchUsers

func SearchUsers(props *model.UserSearch, searchOptions map[string]bool, asAdmin bool) ([]*model.User, *model.AppError)

func SendEmailVerificationCode

func SendEmailVerificationCode(email string) *model.AppError

func SendSmsCode

func SendSmsCode(mobile string, w http.ResponseWriter, r *http.Request) *model.AppError

func SendVerificationCodeToEmail

func SendVerificationCodeToEmail(userEmail, locale, siteURL, verifiedCode string) *model.AppError

func SetCookieAndToken

func SetCookieAndToken(w http.ResponseWriter, r *http.Request, user *model.User) (string, *model.AppError)

func SetOAuthProfileImage

func SetOAuthProfileImage(user *model.User) *model.AppError

func SetProfileImage

func SetProfileImage(w http.ResponseWriter, userId string, imageData *multipart.FileHeader) *model.AppError

func SignupWithOauth

func SignupWithOauth(w http.ResponseWriter, r *http.Request, service, state, loginId, password string) (*model.User, *model.AppError)

func StartServer

func StartServer()

func StopServer

func StopServer()

func UpdatePassword

func UpdatePassword(user *model.User, newPassword string) *model.AppError

func ValidateTokenMiddleware

func ValidateTokenMiddleware(w http.ResponseWriter, r *http.Request) (interface{}, error)

func VerifiedCode

func VerifiedCode(r *http.Request, email, mobile, verificationCode string) *model.AppError

Types

type ALiYunSmsClient

type ALiYunSmsClient struct {
	Request    *model.ALiYunCommunicationRequest
	GatewayUrl string
	Client     *http.Client
}

func NewALiYunSmsClient

func NewALiYunSmsClient(gatewayUrl string) *ALiYunSmsClient

func (*ALiYunSmsClient) Execute

func (smsClient *ALiYunSmsClient) Execute(accessKeyId, accessKeySecret, mobile, signName, templateCode, templateParam string) (err error)

type CorsWrapper

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

func (*CorsWrapper) ServeHTTP

func (cw *CorsWrapper) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RecoveryLogger

type RecoveryLogger struct {
}

func (*RecoveryLogger) Println

func (rl *RecoveryLogger) Println(i ...interface{})

type Server

type Server struct {
	SqlStore       sqlStore.Store
	Router         *mux.Router
	GracefulServer *graceful.Server
}
var Srv *Server

type VaryBy

type VaryBy struct{}

func (*VaryBy) Key

func (m *VaryBy) Key(r *http.Request) string

Jump to

Keyboard shortcuts

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