Documentation ¶
Index ¶
- Constants
- Variables
- func CacheStaticFiles(h http.Handler) http.Handler
- func DynamicUrlSwitch(url string, params map[string]string) string
- func HashPassword(password string) (string, error)
- func IsPartialTemplate(name string) bool
- type Authenticator
- type DynamicQueryString
- type JsonErrorFormat
- type PublicTemplateData
- type Server
- func (s *Server) DoTemplate(w http.ResponseWriter, r *http.Request, name string, status int) error
- func (s *Server) GetAuthMiddleware(next http.Handler) http.Handler
- func (s *Server) GetErrorHandler() http.Handler
- func (s *Server) GetSessionUser(r *http.Request) *SessionUser
- func (s *Server) LookupTemplate(name string) *template.Template
- func (s *Server) ParseTemplates() error
- func (s *Server) StringToDate(date string) time.Time
- func (s *Server) TemplateData(r *http.Request) TemplateData
- type SessionUser
- type Status
- type TemplateData
- type TemplateForm
Constants ¶
View Source
const ( SessionCookieName = "restora-session" SessionCookieState = "state" AuthCodeURL = "somerandomstring" GenericErrMsg = "Please contact the administrator." SessionCookieLoginRedirect = "loginRedirect" SessionCookieToken = "token" SessionUserID = "user-id" SessionEmail = "email" SessionProfileImage = "profile-image" SessionFirstName = "first-name" SessionLastName = "last-name" SessionEmpFirstName = "emp-first-name" SessionEmpLastName = "emp-last-name" SessionDesignation = "designation" SessionRoleID = "roleID" SessionUserName = "userName" SUPERADMIN = "Super Admin" FromName = "restora-session" LimitPerPage = 10 InvitationStatus = 3 )
View Source
const ( HomePath = "/" ErrorPath = "/error" RegistrationPath = "/registration" LoginPath = "/login" ProfilePath = "/profile" ProfileEditPath = "/profile/edit" ResendOtpPath = "/resend-otp" ChangePasswordPath = "/password" ChangePasswordEditPath = "/change/password" OTPPasswordPath = "/otp/password" UploadProfileImagePath = "/profile/update/image" LoginCallBackPath = "/oauth2/callback" RedirectURLPath = "/redirect-url" ConsentPath = "/consent" LogoutPath = "/logout" DashboardPath = "/dashboard" UserListPath = "/user/list" CategoryCreatePath = "/category/create" CategoryEditPath = "/category/edit/{id}" CategoryListPath = "/category/list" CategoryDeletePath = "/category/delete/{id}" BrandCreatePath = "/brand/create" BrandEditPath = "/brand/edit/{id}" BrandListPath = "/brand/list" BrandDeletePath = "/brand/delete/{id}" )
View Source
const TextValidation = `^[A-Za-z.-]+(\s*[A-Za-z.-]+)*$`
regex validation only text, space is allowed but no number is not allowed
Variables ¶
View Source
var ( // NotFound is returned when the requested resource does not exist. NotFound = status.Error(codes.NotFound, "not found") // Conflict is returned when trying to create the same resource twice. Conflict = status.Error(codes.AlreadyExists, "conflict") // UsernameExists is returned when the username already exists in storage. UsernameExists = errors.New("username already exists") // EmailExists is returned when signup email already exists in storage. EmailExists = errors.New("email already exists") // InvCodeExists is returned when invitation code already exists in storage. InvCodeExists = errors.New("invitation code already exists") )
View Source
var (
IgnorePath = []string{LoginPath, RegistrationPath}
)
Functions ¶
func HashPassword ¶
func IsPartialTemplate ¶
Types ¶
type Authenticator ¶
type DynamicQueryString ¶
type DynamicQueryString struct { SearchTerm string StartDate string SortBy string SortByColumn string EndDate string PageNumber int32 CurrentPage int32 Offset int32 OthersValue map[string]string }
func GetQueryStringData ¶
func GetQueryStringData(r *http.Request, keys []string, isNotDefault bool) *DynamicQueryString
type JsonErrorFormat ¶
type PublicTemplateData ¶
type PublicTemplateData struct {
UserInfo *SessionUser
}
type Server ¶
type Server struct { Env string Config *viper.Viper Logger *logrus.Entry Assets *hashfs.FS Decoder *schema.Decoder Auth *Authenticator Cookies *sessions.CookieStore Templates *template.Template Sess *sessions.Session User user.UserServiceClient Login auth.LoginServiceClient Category category.CategoryServiceClient Brand brand.BrandServiceClient }
func (*Server) DoTemplate ¶
func (*Server) GetAuthMiddleware ¶
func (*Server) GetErrorHandler ¶
func (*Server) GetSessionUser ¶
func (s *Server) GetSessionUser(r *http.Request) *SessionUser
func (*Server) ParseTemplates ¶
func (*Server) TemplateData ¶
func (s *Server) TemplateData(r *http.Request) TemplateData
type SessionUser ¶
type TemplateData ¶
type TemplateData struct { Env string CSRFField template.HTML Form TemplateForm }
type TemplateForm ¶
Click to show internal directories.
Click to hide internal directories.