auth

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2014 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignForm

func AssignForm(form interface{}, data base.TmplData)

AssignForm assign form values back to the template data.

func GetMinMaxSize added in v0.4.0

func GetMinMaxSize(field reflect.StructField) string

func IsSignedIn

func IsSignedIn(session session.SessionStore) bool

IsSignedIn check if any user has signed in.

func SignedInId

func SignedInId(session session.SessionStore) int64

SignedInId returns the id of signed in user.

func SignedInName

func SignedInName(session session.SessionStore) string

SignedInName returns the name of signed in user.

func SignedInUser

func SignedInUser(session session.SessionStore) *models.User

SignedInUser returns the user object of signed user.

Types

type AddSSHKeyForm

type AddSSHKeyForm struct {
	KeyName    string `form:"keyname" binding:"Required"`
	KeyContent string `form:"key_content" binding:"Required"`
}

func (*AddSSHKeyForm) Name

func (f *AddSSHKeyForm) Name(field string) string

func (*AddSSHKeyForm) Validate

func (f *AddSSHKeyForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context)

type AdminEditUserForm

type AdminEditUserForm struct {
	Email     string `form:"email" binding:"Required;Email;MaxSize(50)"`
	Website   string `form:"website" binding:"MaxSize(50)"`
	Location  string `form:"location" binding:"MaxSize(50)"`
	Avatar    string `form:"avatar" binding:"Required;Email;MaxSize(50)"`
	Active    bool   `form:"active"`
	Admin     bool   `form:"admin"`
	LoginType int    `form:"login_type"`
}

func (*AdminEditUserForm) Name

func (f *AdminEditUserForm) Name(field string) string

func (*AdminEditUserForm) Validate

func (f *AdminEditUserForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context)

type AuthenticationForm added in v0.4.0

type AuthenticationForm struct {
	Id                int64  `form:"id"`
	Type              int    `form:"type"`
	AuthName          string `form:"name" binding:"Required;MaxSize(50)"`
	Domain            string `form:"domain"`
	Host              string `form:"host"`
	Port              int    `form:"port"`
	UseSSL            bool   `form:"usessl"`
	BaseDN            string `form:"base_dn"`
	Attributes        string `form:"attributes"`
	Filter            string `form:"filter"`
	MsAdSA            string `form:"ms_ad_sa"`
	IsActived         bool   `form:"is_actived"`
	SmtpAuth          string `form:"smtpauth"`
	SmtpHost          string `form:"smtphost"`
	SmtpPort          int    `form:"smtpport"`
	Tls               bool   `form:"tls"`
	AllowAutoRegister bool   `form:"allowautoregister"`
}

func (*AuthenticationForm) Name added in v0.4.0

func (f *AuthenticationForm) Name(field string) string

func (*AuthenticationForm) Validate added in v0.4.0

func (f *AuthenticationForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context)

type CreateIssueForm

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

func (*CreateIssueForm) Name

func (f *CreateIssueForm) Name(field string) string

func (*CreateIssueForm) Validate

func (f *CreateIssueForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context)

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) Name added in v0.4.0

func (f *CreateLabelForm) Name(field string) string

func (*CreateLabelForm) Validate added in v0.4.0

func (f *CreateLabelForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context)

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) Name added in v0.4.0

func (f *CreateMilestoneForm) Name(field string) string

func (*CreateMilestoneForm) Validate added in v0.4.0

func (f *CreateMilestoneForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context)

type CreateRepoForm

type CreateRepoForm struct {
	RepoName    string `form:"repo" binding:"Required;AlphaDash;MaxSize(100)"`
	Private     bool   `form:"private"`
	Description string `form:"desc" binding:"MaxSize(100)"`
	Language    string `form:"language"`
	License     string `form:"license"`
	InitReadme  bool   `form:"initReadme"`
}

func (*CreateRepoForm) Name

func (f *CreateRepoForm) Name(field string) string

func (*CreateRepoForm) Validate

func (f *CreateRepoForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context)

type FeedsForm

type FeedsForm struct {
	UserId int64 `form:"userid" binding:"Required"`
	Page   int64 `form:"p"`
}

type Form

type Form interface {
	Name(field string) string
}

Web form interface.

type InstallForm

type InstallForm struct {
	Database        string `form:"database" binding:"Required"`
	Host            string `form:"host"`
	User            string `form:"user"`
	Passwd          string `form:"passwd"`
	DatabaseName    string `form:"database_name"`
	SslMode         string `form:"ssl_mode"`
	DatabasePath    string `form:"database_path"`
	RepoRootPath    string `form:"repo_path"`
	RunUser         string `form:"run_user"`
	Domain          string `form:"domain"`
	AppUrl          string `form:"app_url"`
	AdminName       string `form:"admin_name" binding:"Required;AlphaDashDot;MaxSize(30)"`
	AdminPasswd     string `form:"admin_pwd" binding:"Required;MinSize(6);MaxSize(30)"`
	AdminEmail      string `form:"admin_email" binding:"Required;Email;MaxSize(50)"`
	SmtpHost        string `form:"smtp_host"`
	SmtpEmail       string `form:"mailer_user"`
	SmtpPasswd      string `form:"mailer_pwd"`
	RegisterConfirm string `form:"register_confirm"`
	MailNotify      string `form:"mail_notify"`
}

func (*InstallForm) Name

func (f *InstallForm) Name(field string) string

func (*InstallForm) Validate

func (f *InstallForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context)

type LogInForm

type LogInForm struct {
	UserName string `form:"username" binding:"Required;MaxSize(35)"`
	Password string `form:"passwd" binding:"Required;MinSize(6);MaxSize(30)"`
	Remember bool   `form:"remember"`
}

func (*LogInForm) Name

func (f *LogInForm) Name(field string) string

func (*LogInForm) Validate

func (f *LogInForm) Validate(errs *binding.Errors, req *http.Request, ctx martini.Context)

type MigrateRepoForm added in v0.3.0

type MigrateRepoForm struct {
	Url          string `form:"url" binding:"Url"`
	AuthUserName string `form:"auth_username"`
	AuthPasswd   string `form:"auth_password"`
	RepoName     string `form:"repo" binding:"Required;AlphaDash;MaxSize(100)"`
	Mirror       bool   `form:"mirror"`
	Private      bool   `form:"private"`
	Description  string `form:"desc" binding:"MaxSize(100)"`
}

func (*MigrateRepoForm) Name added in v0.3.0

func (f *MigrateRepoForm) Name(field string) string

func (*MigrateRepoForm) Validate added in v0.3.0

func (f *MigrateRepoForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context)

type NewReleaseForm added in v0.3.0

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

func (*NewReleaseForm) Name added in v0.3.0

func (f *NewReleaseForm) Name(field string) string

func (*NewReleaseForm) Validate added in v0.3.0

func (f *NewReleaseForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context)

type NewWebhookForm added in v0.4.0

type NewWebhookForm struct {
	Url         string `form:"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) Name added in v0.4.0

func (f *NewWebhookForm) Name(field string) string

func (*NewWebhookForm) Validate added in v0.4.0

func (f *NewWebhookForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context)

type RegisterForm

type RegisterForm struct {
	UserName     string `form:"username" binding:"Required;AlphaDashDot;MaxSize(30)"`
	Email        string `form:"email" binding:"Required;Email;MaxSize(50)"`
	Password     string `form:"passwd" binding:"Required;MinSize(6);MaxSize(30)"`
	RetypePasswd string `form:"retypepasswd"`
	LoginType    string `form:"logintype"`
	LoginName    string `form:"loginname"`
}

func (*RegisterForm) Name

func (f *RegisterForm) Name(field string) string

func (*RegisterForm) Validate

func (f *RegisterForm) Validate(errs *binding.Errors, req *http.Request, ctx martini.Context)

type RepoSettingForm added in v0.4.0

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

func (*RepoSettingForm) Name added in v0.4.0

func (f *RepoSettingForm) Name(field string) string

func (*RepoSettingForm) Validate added in v0.4.0

func (f *RepoSettingForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context)

type UpdatePasswdForm

type UpdatePasswdForm struct {
	OldPasswd    string `form:"oldpasswd" binding:"Required;MinSize(6);MaxSize(30)"`
	NewPasswd    string `form:"newpasswd" binding:"Required;MinSize(6);MaxSize(30)"`
	RetypePasswd string `form:"retypepasswd"`
}

func (*UpdatePasswdForm) Name

func (f *UpdatePasswdForm) Name(field string) string

func (*UpdatePasswdForm) Validate

func (f *UpdatePasswdForm) Validate(errs *binding.Errors, req *http.Request, ctx martini.Context)

type UpdateProfileForm

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

func (*UpdateProfileForm) Name

func (f *UpdateProfileForm) Name(field string) string

func (*UpdateProfileForm) Validate

func (f *UpdateProfileForm) Validate(errs *binding.Errors, req *http.Request, ctx martini.Context)

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