auth

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2015 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignForm

func AssignForm(form interface{}, data map[string]interface{})

AssignForm assign form values back to the template data.

func GetMaxSize added in v0.5.0

func GetMaxSize(field reflect.StructField) string

func GetMinSize added in v0.5.0

func GetMinSize(field reflect.StructField) string

func SignedInId

func SignedInId(req *http.Request, sess session.Store) int64

SignedInId returns the id of signed in user.

func SignedInUser

func SignedInUser(req *http.Request, sess session.Store) (*models.User, bool)

SignedInUser returns the user object of signed user. It returns a bool value to indicate whether user uses basic auth or not.

Types

type AddEmailForm added in v0.5.11

type AddEmailForm struct {
	Email string `binding:"Required;Email;MaxSize(50)"`
}

func (*AddEmailForm) Validate added in v0.5.11

func (f *AddEmailForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type AddSSHKeyForm

type AddSSHKeyForm struct {
	SSHTitle string `form:"title" binding:"Required"`
	Content  string `form:"content" binding:"Required"`
}

func (*AddSSHKeyForm) Validate

func (f *AddSSHKeyForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type AdminEditUserForm

type AdminEditUserForm struct {
	Email        string `binding:"Required;Email;MaxSize(50)"`
	Password     string `binding:"OmitEmpty;MinSize(6);MaxSize(255)"`
	Website      string `binding:"MaxSize(50)"`
	Location     string `binding:"MaxSize(50)"`
	Avatar       string `binding:"Required;Email;MaxSize(50)"`
	Active       bool
	Admin        bool
	AllowGitHook bool
	LoginType    int
}

func (*AdminEditUserForm) Validate

func (f *AdminEditUserForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type AuthenticationForm added in v0.4.0

type AuthenticationForm struct {
	ID                int64 `form:"id"`
	Type              int
	Name              string `binding:"Required;MaxSize(50)"`
	Domain            string
	Host              string
	Port              int
	UseSSL            bool   `form:"usessl"`
	BaseDN            string `form:"base_dn"`
	AttributeUsername string
	AttributeName     string
	AttributeSurname  string
	AttributeMail     string
	Filter            string
	MsAdSA            string `form:"ms_ad_sa"`
	IsActived         bool
	SMTPAuth          string `form:"smtp_auth"`
	SMTPHost          string `form:"smtp_host"`
	SMTPPort          int    `form:"smtp_port"`
	TLS               bool   `form:"tls"`
	AllowAutoRegister bool   `form:"allowautoregister"`
}

func (*AuthenticationForm) Validate added in v0.4.0

func (f *AuthenticationForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type ChangePasswordForm added in v0.5.0

type ChangePasswordForm struct {
	OldPassword string `form:"old_password" binding:"Required;MinSize(6);MaxSize(255)"`
	Password    string `form:"password" binding:"Required;MinSize(6);MaxSize(255)"`
	Retype      string `form:"retype"`
}

func (*ChangePasswordForm) Validate added in v0.5.0

func (f *ChangePasswordForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type CreateIssueForm

type CreateIssueForm struct {
	IssueName   string `form:"title" binding:"Required;MaxSize(255)"`
	MilestoneId int64  `form:"milestoneid"`
	AssigneeId  int64  `form:"assigneeid"`
	Labels      string `form:"labels"`
	Content     string `form:"content"`
}

func (*CreateIssueForm) Validate

func (f *CreateIssueForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type CreateLabelForm added in v0.4.0

type CreateLabelForm struct {
	Title string `form:"title" binding:"Required;MaxSize(50)"`
	Color string `form:"color" binding:"Required;Size(7)"`
}

func (*CreateLabelForm) Validate added in v0.4.0

func (f *CreateLabelForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type CreateMilestoneForm added in v0.4.0

type CreateMilestoneForm struct {
	Title    string `form:"title" binding:"Required;MaxSize(50)"`
	Content  string `form:"content"`
	Deadline string `form:"due_date"`
}

func (*CreateMilestoneForm) Validate added in v0.4.0

type CreateOrgForm added in v0.5.0

type CreateOrgForm struct {
	OrgName string `form:"org_name" binding:"Required;AlphaDashDot;MaxSize(30)"`
	Email   string `form:"email" binding:"Required;Email;MaxSize(50)"`
}

func (*CreateOrgForm) Validate added in v0.5.0

func (f *CreateOrgForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type CreateRepoForm

type CreateRepoForm struct {
	Uid         int64  `form:"uid" binding:"Required"`
	RepoName    string `form:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"`
	Private     bool   `form:"private"`
	Description string `form:"desc" binding:"MaxSize(255)"`
	AutoInit    bool   `form:"auto_init"`
	Gitignore   string `form:"gitignore"`
	License     string `form:"license"`
}

func (*CreateRepoForm) Validate

func (f *CreateRepoForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type CreateTeamForm added in v0.5.0

type CreateTeamForm struct {
	TeamName    string `form:"team_name" binding:"Required;AlphaDashDot;MaxSize(30)"`
	Description string `form:"desc" binding:"MaxSize(255)"`
	Permission  string `form:"permission"`
}

func (*CreateTeamForm) Validate added in v0.5.0

func (f *CreateTeamForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type EditReleaseForm added in v0.5.0

type EditReleaseForm struct {
	Title      string `form:"title" binding:"Required"`
	Content    string `form:"content" binding:"Required"`
	Draft      string `form:"draft"`
	Prerelease bool   `form:"prerelease"`
}

func (*EditReleaseForm) Validate added in v0.5.0

func (f *EditReleaseForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type Form

type Form interface {
	binding.Validator
}

type InstallForm

type InstallForm struct {
	DbType             string `binding:"Required"`
	DbHost             string
	DbUser             string
	DbPasswd           string
	DbName             string
	SSLMode            string
	DbPath             string
	RepoRootPath       string `binding:"Required"`
	RunUser            string `binding:"Required"`
	Domain             string `binding:"Required"`
	HTTPPort           string `binding:"Required"`
	AppUrl             string `binding:"Required"`
	SMTPHost           string
	SMTPEmail          string
	SMTPPasswd         string
	RegisterConfirm    string
	MailNotify         string
	AdminName          string `binding:"Required;AlphaDashDot;MaxSize(30)"`
	AdminPasswd        string `binding:"Required;MinSize(6);MaxSize(255)"`
	AdminConfirmPasswd string `binding:"Required;MinSize(6);MaxSize(255)"`
	AdminEmail         string `binding:"Required;Email;MaxSize(50)"`
}

func (*InstallForm) Validate

func (f *InstallForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type MigrateRepoForm added in v0.3.0

type MigrateRepoForm struct {
	CloneAddr    string `binding:"Required"`
	AuthUsername string
	AuthPassword string
	Uid          int64  `binding:"Required"`
	RepoName     string `binding:"Required;AlphaDashDot;MaxSize(100)"`
	Mirror       bool
	Private      bool
	Description  string `binding:"MaxSize(255)"`
}

func (*MigrateRepoForm) Validate added in v0.3.0

func (f *MigrateRepoForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type NewAccessTokenForm added in v0.5.8

type NewAccessTokenForm struct {
	Name string `form:"name" binding:"Required"`
}

func (*NewAccessTokenForm) Validate added in v0.5.8

func (f *NewAccessTokenForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type NewReleaseForm added in v0.3.0

type NewReleaseForm struct {
	TagName    string `form:"tag_name" binding:"Required"`
	Target     string `form:"tag_target" binding:"Required"`
	Title      string `form:"title" binding:"Required"`
	Content    string `form:"content" binding:"Required"`
	Draft      string `form:"draft"`
	Prerelease bool   `form:"prerelease"`
}

func (*NewReleaseForm) Validate added in v0.3.0

func (f *NewReleaseForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type NewSlackHookForm added in v0.5.0

type NewSlackHookForm struct {
	HookTaskType string `form:"hook_type" binding:"Required"`
	PayloadUrl   string `form:"payload_url" binding:"Required`
	Channel      string `form:"channel" binding:"Required"`
	PushOnly     bool   `form:"push_only"`
	Active       bool   `form:"active"`
}

func (*NewSlackHookForm) Validate added in v0.5.0

func (f *NewSlackHookForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type NewWebhookForm added in v0.4.0

type NewWebhookForm struct {
	HookTaskType string `form:"hook_type" binding:"Required"`
	PayloadUrl   string `form:"payload_url" binding:"Required;Url"`
	ContentType  string `form:"content_type" binding:"Required"`
	Secret       string `form:"secret"`
	PushOnly     bool   `form:"push_only"`
	Active       bool   `form:"active"`
}

func (*NewWebhookForm) Validate added in v0.4.0

func (f *NewWebhookForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type RegisterForm

type RegisterForm struct {
	UserName  string `form:"uname" binding:"Required;AlphaDashDot;MaxSize(35)"`
	Email     string `form:"email" binding:"Required;Email;MaxSize(50)"`
	Password  string `form:"password" binding:"Required;MinSize(6);MaxSize(255)"`
	Retype    string `form:"retype"`
	LoginType string `form:"logintype"`
	LoginName string `form:"loginname"`
}

func (*RegisterForm) Validate

func (f *RegisterForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type RepoSettingForm added in v0.4.0

type RepoSettingForm struct {
	RepoName    string `form:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"`
	Description string `form:"desc" binding:"MaxSize(255)"`
	Website     string `form:"site" binding:"Url;MaxSize(100)"`
	Branch      string `form:"branch"`
	Interval    int    `form:"interval"`
	Private     bool   `form:"private"`
}

func (*RepoSettingForm) Validate added in v0.4.0

func (f *RepoSettingForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type SignInForm added in v0.5.0

type SignInForm struct {
	UserName string `form:"uname" binding:"Required;MaxSize(35)"`
	Password string `form:"password" binding:"Required;MinSize(6);MaxSize(255)"`
	Remember bool   `form:"remember"`
}

func (*SignInForm) Validate added in v0.5.0

func (f *SignInForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type UpdateOrgSettingForm added in v0.5.0

type UpdateOrgSettingForm struct {
	OrgUserName string `form:"uname" binding:"Required;MaxSize(35)"`
	OrgFullName string `form:"fullname" binding:"MaxSize(100)"`
	Email       string `form:"email" binding:"Required;Email;MaxSize(50)"`
	Description string `form:"desc" binding:"MaxSize(255)"`
	Website     string `form:"website" binding:"Url;MaxSize(100)"`
	Location    string `form:"location" binding:"MaxSize(50)"`
	Avatar      string `form:"avatar" binding:"Required;Email;MaxSize(50)"`
}

func (*UpdateOrgSettingForm) Validate added in v0.5.0

type UpdateProfileForm

type UpdateProfileForm struct {
	UserName string `form:"uname" binding:"Required;MaxSize(35)"`
	FullName string `form:"fullname" binding:"MaxSize(100)"`
	Email    string `form:"email" binding:"Required;Email;MaxSize(50)"`
	Website  string `form:"website" binding:"Url;MaxSize(100)"`
	Location string `form:"location" binding:"MaxSize(50)"`
	Avatar   string `form:"avatar" binding:"Required;Email;MaxSize(50)"`
}

func (*UpdateProfileForm) Validate

func (f *UpdateProfileForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

type UploadAvatarForm added in v0.5.9

type UploadAvatarForm struct {
	Enable bool                  `form:"enable"`
	Avatar *multipart.FileHeader `form:"avatar"`
}

func (*UploadAvatarForm) Validate added in v0.5.9

func (f *UploadAvatarForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

Directories

Path Synopsis
package ldap provide functions & structure to query a LDAP ldap directory For now, it's mainly tested again an MS Active Directory service, see README.md for more information
package ldap provide functions & structure to query a LDAP ldap directory For now, it's mainly tested again an MS Active Directory service, see README.md for more information

Jump to

Keyboard shortcuts

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