gitea: code.gitea.io/gitea/modules/auth Index | Files | Directories

package auth

import "code.gitea.io/gitea/modules/auth"

Index

Package Files

admin.go auth.go auth_form.go org.go repo_branch_form.go repo_form.go user_form.go user_form_auth_openid.go

Constants

const (
    AvatarLocal  string = "local"
    AvatarByMail string = "bymail"
)

Avatar types

func AssignForm Uses

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

AssignForm assign form values back to the template data.

func CheckOAuthAccessToken Uses

func CheckOAuthAccessToken(accessToken string) int64

CheckOAuthAccessToken returns uid of user from oauth token token

func GetInclude Uses

func GetInclude(field reflect.StructField) string

GetInclude get include in form tag

func GetMaxSize Uses

func GetMaxSize(field reflect.StructField) string

GetMaxSize get max size in form tag

func GetMinSize Uses

func GetMinSize(field reflect.StructField) string

GetMinSize get minimal size in form tag

func GetSize Uses

func GetSize(field reflect.StructField) string

GetSize get size int form tag

func IsAPIPath Uses

func IsAPIPath(url string) bool

IsAPIPath if URL is an api path

func IsAttachmentDownload Uses

func IsAttachmentDownload(ctx *macaron.Context) bool

IsAttachmentDownload check if request is a file download (GET) with URL to an attachment

func SignedInID Uses

func SignedInID(ctx *macaron.Context, sess session.Store) int64

SignedInID returns the id of signed in user.

func SignedInUser Uses

func SignedInUser(ctx *macaron.Context, 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.

type AccessTokenForm Uses

type AccessTokenForm struct {
    GrantType    string `json:"grant_type"`
    ClientID     string `json:"client_id"`
    ClientSecret string `json:"client_secret"`
    RedirectURI  string `json:"redirect_uri"`
    Code         string `json:"code"`
    RefreshToken string `json:"refresh_token"`

    // PKCE support
    CodeVerifier string `json:"code_verifier"`
}

AccessTokenForm for issuing access tokens from authorization codes or refresh tokens

func (*AccessTokenForm) Validate Uses

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

Validate valideates the fields

type AddEmailForm Uses

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

AddEmailForm form for adding new email

func (*AddEmailForm) Validate Uses

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

Validate validates the fields

type AddKeyForm Uses

type AddKeyForm struct {
    Type       string `binding:"OmitEmpty"`
    Title      string `binding:"Required;MaxSize(50)"`
    Content    string `binding:"Required"`
    IsWritable bool
}

AddKeyForm form for adding SSH/GPG key

func (*AddKeyForm) Validate Uses

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

Validate validates the fields

type AddOpenIDForm Uses

type AddOpenIDForm struct {
    Openid string `binding:"Required;MaxSize(256)"`
}

AddOpenIDForm is for changing openid uri

func (*AddOpenIDForm) Validate Uses

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

Validate validates the fields

type AddTimeManuallyForm Uses

type AddTimeManuallyForm struct {
    Hours   int `binding:"Range(0,1000)"`
    Minutes int `binding:"Range(0,1000)"`
}

AddTimeManuallyForm form that adds spent time manually.

func (*AddTimeManuallyForm) Validate Uses

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

Validate validates the fields

type AdminCreateUserForm Uses

type AdminCreateUserForm struct {
    LoginType          string `binding:"Required"`
    LoginName          string
    UserName           string `binding:"Required;AlphaDashDot;MaxSize(40)"`
    Email              string `binding:"Required;Email;MaxSize(254)"`
    Password           string `binding:"MaxSize(255)"`
    SendNotify         bool
    MustChangePassword bool
}

AdminCreateUserForm form for admin to create user

func (*AdminCreateUserForm) Validate Uses

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

Validate validates form fields

type AdminEditUserForm Uses

type AdminEditUserForm struct {
    LoginType               string `binding:"Required"`
    LoginName               string
    FullName                string `binding:"MaxSize(100)"`
    Email                   string `binding:"Required;Email;MaxSize(254)"`
    Password                string `binding:"MaxSize(255)"`
    Website                 string `binding:"ValidUrl;MaxSize(255)"`
    Location                string `binding:"MaxSize(50)"`
    MaxRepoCreation         int
    Active                  bool
    Admin                   bool
    AllowGitHook            bool
    AllowImportLocal        bool
    AllowCreateOrganization bool
    ProhibitLogin           bool
}

AdminEditUserForm form for admin to create user

func (*AdminEditUserForm) Validate Uses

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

Validate validates form fields

type AuthenticationForm Uses

type AuthenticationForm struct {
    ID                            int64
    Type                          int    `binding:"Range(2,6)"`
    Name                          string `binding:"Required;MaxSize(30)"`
    Host                          string
    Port                          int
    BindDN                        string
    BindPassword                  string
    UserBase                      string
    UserDN                        string
    AttributeUsername             string
    AttributeName                 string
    AttributeSurname              string
    AttributeMail                 string
    AttributeSSHPublicKey         string
    AttributesInBind              bool
    UsePagedSearch                bool
    SearchPageSize                int
    Filter                        string
    AdminFilter                   string
    IsActive                      bool
    IsSyncEnabled                 bool
    SMTPAuth                      string
    SMTPHost                      string
    SMTPPort                      int
    AllowedDomains                string
    SecurityProtocol              int `binding:"Range(0,2)"`
    TLS                           bool
    SkipVerify                    bool
    PAMServiceName                string
    Oauth2Provider                string
    Oauth2Key                     string
    Oauth2Secret                  string
    OpenIDConnectAutoDiscoveryURL string
    Oauth2UseCustomURL            bool
    Oauth2TokenURL                string
    Oauth2AuthURL                 string
    Oauth2ProfileURL              string
    Oauth2EmailURL                string
}

AuthenticationForm form for authentication

func (*AuthenticationForm) Validate Uses

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

Validate validates fields

type AuthorizationForm Uses

type AuthorizationForm struct {
    ResponseType string `binding:"Required;In(code)"`
    ClientID     string `binding:"Required"`
    RedirectURI  string
    State        string

    // PKCE support
    CodeChallengeMethod string // S256, plain
    CodeChallenge       string
}

AuthorizationForm form for authorizing oauth2 clients

func (*AuthorizationForm) Validate Uses

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

Validate valideates the fields

type AvatarForm Uses

type AvatarForm struct {
    Source      string
    Avatar      *multipart.FileHeader
    Gravatar    string `binding:"OmitEmpty;Email;MaxSize(254)"`
    Federavatar bool
}

AvatarForm form for changing avatar

func (*AvatarForm) Validate Uses

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

Validate validates the fields

type ChangePasswordForm Uses

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

ChangePasswordForm form for changing password

func (*ChangePasswordForm) Validate Uses

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

Validate validates the fields

type CodeCommentForm Uses

type CodeCommentForm struct {
    Content  string `binding:"Required"`
    Side     string `binding:"Required;In(previous,proposed)"`
    Line     int64
    TreePath string `form:"path" binding:"Required"`
    IsReview bool   `form:"is_review"`
    Reply    int64  `form:"reply"`
}

CodeCommentForm form for adding code comments for PRs

func (*CodeCommentForm) Validate Uses

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

Validate validates the fields

type ConnectOpenIDForm Uses

type ConnectOpenIDForm struct {
    UserName string `binding:"Required;MaxSize(254)"`
    Password string `binding:"Required;MaxSize(255)"`
}

ConnectOpenIDForm form for connecting an existing account to an OpenID URI

func (*ConnectOpenIDForm) Validate Uses

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

Validate valideates the fields

type CreateCommentForm Uses

type CreateCommentForm struct {
    Content string
    Status  string `binding:"OmitEmpty;In(reopen,close)"`
    Files   []string
}

CreateCommentForm form for creating comment

func (*CreateCommentForm) Validate Uses

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

Validate validates the fields

type CreateIssueForm Uses

type CreateIssueForm struct {
    Title       string `binding:"Required;MaxSize(255)"`
    LabelIDs    string `form:"label_ids"`
    AssigneeIDs string `form:"assignee_ids"`
    Ref         string `form:"ref"`
    MilestoneID int64
    AssigneeID  int64
    Content     string
    Files       []string
}

CreateIssueForm form for creating issue

func (*CreateIssueForm) Validate Uses

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

Validate validates the fields

type CreateLabelForm Uses

type CreateLabelForm struct {
    ID          int64
    Title       string `binding:"Required;MaxSize(50)" locale:"repo.issues.label_title"`
    Description string `binding:"MaxSize(200)" locale:"repo.issues.label_description"`
    Color       string `binding:"Required;Size(7)" locale:"repo.issues.label_color"`
}

CreateLabelForm form for creating label

func (*CreateLabelForm) Validate Uses

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

Validate validates the fields

type CreateMilestoneForm Uses

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

CreateMilestoneForm form for creating milestone

func (*CreateMilestoneForm) Validate Uses

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

Validate validates the fields

type CreateOrgForm Uses

type CreateOrgForm struct {
    OrgName                   string `binding:"Required;AlphaDashDot;MaxSize(40)" locale:"org.org_name_holder"`
    Visibility                structs.VisibleType
    RepoAdminChangeTeamAccess bool
}

CreateOrgForm form for creating organization

func (*CreateOrgForm) Validate Uses

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

Validate validates the fields

type CreateRepoForm Uses

type CreateRepoForm struct {
    UID         int64  `binding:"Required"`
    RepoName    string `binding:"Required;AlphaDashDot;MaxSize(100)"`
    Private     bool
    Description string `binding:"MaxSize(255)"`
    AutoInit    bool
    Gitignores  string
    IssueLabels string
    License     string
    Readme      string

    RepoTemplate int64
    GitContent   bool
    Topics       bool
}

CreateRepoForm form for creating repository

func (*CreateRepoForm) Validate Uses

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

Validate validates the fields

type CreateTeamForm Uses

type CreateTeamForm struct {
    TeamName         string `binding:"Required;AlphaDashDot;MaxSize(30)"`
    Description      string `binding:"MaxSize(255)"`
    Permission       string
    Units            []models.UnitType
    RepoAccess       string
    CanCreateOrgRepo bool
}

CreateTeamForm form for creating team

func (*CreateTeamForm) Validate Uses

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

Validate validates the fields

type DeadlineForm Uses

type DeadlineForm struct {
    DateString string `form:"date" binding:"Required;Size(10)"`
}

DeadlineForm hold the validation rules for deadlines

func (*DeadlineForm) Validate Uses

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

Validate validates the fields

type DeleteRepoFileForm Uses

type DeleteRepoFileForm struct {
    CommitSummary string `binding:"MaxSize(100)"`
    CommitMessage string
    CommitChoice  string `binding:"Required;MaxSize(50)"`
    NewBranchName string `binding:"GitRefName;MaxSize(100)"`
    LastCommit    string
}

DeleteRepoFileForm form for deleting repository file

func (*DeleteRepoFileForm) Validate Uses

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

Validate validates the fields

type EditOAuth2ApplicationForm Uses

type EditOAuth2ApplicationForm struct {
    Name        string `binding:"Required;MaxSize(255)" form:"application_name"`
    RedirectURI string `binding:"Required" form:"redirect_uri"`
}

EditOAuth2ApplicationForm form for editing oauth2 applications

func (*EditOAuth2ApplicationForm) Validate Uses

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

Validate valideates the fields

type EditPreviewDiffForm Uses

type EditPreviewDiffForm struct {
    Content string
}

EditPreviewDiffForm form for changing preview diff

func (*EditPreviewDiffForm) Validate Uses

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

Validate validates the fields

type EditReleaseForm Uses

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

EditReleaseForm form for changing release

func (*EditReleaseForm) Validate Uses

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

Validate validates the fields

type EditRepoFileForm Uses

type EditRepoFileForm struct {
    TreePath      string `binding:"Required;MaxSize(500)"`
    Content       string
    CommitSummary string `binding:"MaxSize(100)"`
    CommitMessage string
    CommitChoice  string `binding:"Required;MaxSize(50)"`
    NewBranchName string `binding:"GitRefName;MaxSize(100)"`
    LastCommit    string
}

EditRepoFileForm form for changing repository file

func (*EditRepoFileForm) Validate Uses

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

Validate validates the fields

type Form Uses

type Form interface {
    binding.Validator
}

Form form binding interface

type GrantApplicationForm Uses

type GrantApplicationForm struct {
    ClientID    string `binding:"Required"`
    RedirectURI string
    State       string
}

GrantApplicationForm form for authorizing oauth2 clients

func (*GrantApplicationForm) Validate Uses

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

Validate valideates the fields

type InitializeLabelsForm Uses

type InitializeLabelsForm struct {
    TemplateName string `binding:"Required"`
}

InitializeLabelsForm form for initializing labels

func (*InitializeLabelsForm) Validate Uses

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

Validate validates the fields

type InstallForm Uses

type InstallForm struct {
    DbType   string `binding:"Required"`
    DbHost   string
    DbUser   string
    DbPasswd string
    DbName   string
    SSLMode  string
    Charset  string `binding:"Required;In(utf8,utf8mb4)"`
    DbPath   string

    AppName      string `binding:"Required" locale:"install.app_name"`
    RepoRootPath string `binding:"Required"`
    LFSRootPath  string
    RunUser      string `binding:"Required"`
    Domain       string `binding:"Required"`
    SSHPort      int
    HTTPPort     string `binding:"Required"`
    AppURL       string `binding:"Required"`
    LogRootPath  string `binding:"Required"`

    SMTPHost        string
    SMTPFrom        string
    SMTPUser        string `binding:"OmitEmpty;MaxSize(254)" locale:"install.mailer_user"`
    SMTPPasswd      string
    RegisterConfirm bool
    MailNotify      bool

    OfflineMode                    bool
    DisableGravatar                bool
    EnableFederatedAvatar          bool
    EnableOpenIDSignIn             bool
    EnableOpenIDSignUp             bool
    DisableRegistration            bool
    AllowOnlyExternalRegistration  bool
    EnableCaptcha                  bool
    RequireSignInView              bool
    DefaultKeepEmailPrivate        bool
    DefaultAllowCreateOrganization bool
    DefaultEnableTimetracking      bool
    NoReplyAddress                 string

    AdminName          string `binding:"OmitEmpty;AlphaDashDot;MaxSize(30)" locale:"install.admin_name"`
    AdminPasswd        string `binding:"OmitEmpty;MaxSize(255)" locale:"install.admin_password"`
    AdminConfirmPasswd string
    AdminEmail         string `binding:"OmitEmpty;MinSize(3);MaxSize(254);Include(@)" locale:"install.admin_email"`
}

InstallForm form for installation page

func (*InstallForm) Validate Uses

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

Validate validates the fields

type IssueLockForm Uses

type IssueLockForm struct {
    Reason string `binding:"Required"`
}

IssueLockForm form for locking an issue

func (IssueLockForm) HasValidReason Uses

func (i IssueLockForm) HasValidReason() bool

HasValidReason checks to make sure that the reason submitted in the form matches any of the values in the config

func (*IssueLockForm) Validate Uses

func (i *IssueLockForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors

Validate validates the fields

type MergePullRequestForm Uses

type MergePullRequestForm struct {
    // required: true
    // enum: merge,rebase,rebase-merge,squash
    Do                string `binding:"Required;In(merge,rebase,rebase-merge,squash)"`
    MergeTitleField   string
    MergeMessageField string
}

MergePullRequestForm form for merging Pull Request swagger:model MergePullRequestOption

func (*MergePullRequestForm) Validate Uses

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

Validate validates the fields

type MigrateRepoForm Uses

type MigrateRepoForm struct {
    // required: true
    CloneAddr    string `json:"clone_addr" binding:"Required"`
    AuthUsername string `json:"auth_username"`
    AuthPassword string `json:"auth_password"`
    // required: true
    UID int64 `json:"uid" binding:"Required"`
    // required: true
    RepoName     string `json:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"`
    Mirror       bool   `json:"mirror"`
    Private      bool   `json:"private"`
    Description  string `json:"description" binding:"MaxSize(255)"`
    Wiki         bool   `json:"wiki"`
    Milestones   bool   `json:"milestones"`
    Labels       bool   `json:"labels"`
    Issues       bool   `json:"issues"`
    PullRequests bool   `json:"pull_requests"`
    Releases     bool   `json:"releases"`
}

MigrateRepoForm form for migrating repository

func (MigrateRepoForm) ParseRemoteAddr Uses

func (f MigrateRepoForm) ParseRemoteAddr(user *models.User) (string, error)

ParseRemoteAddr checks if given remote address is valid, and returns composed URL with needed username and password. It also checks if given user has permission when remote address is actually a local path.

func (*MigrateRepoForm) Validate Uses

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

Validate validates the fields

type MustChangePasswordForm Uses

type MustChangePasswordForm struct {
    Password string `binding:"Required;MaxSize(255)"`
    Retype   string
}

MustChangePasswordForm form for updating your password after account creation by an admin

func (*MustChangePasswordForm) Validate Uses

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

Validate valideates the fields

type NewAccessTokenForm Uses

type NewAccessTokenForm struct {
    Name string `binding:"Required;MaxSize(255)"`
}

NewAccessTokenForm form for creating access token

func (*NewAccessTokenForm) Validate Uses

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

Validate valideates the fields

type NewBranchForm Uses

type NewBranchForm struct {
    NewBranchName string `binding:"Required;MaxSize(100);GitRefName"`
}

NewBranchForm form for creating a new branch

func (*NewBranchForm) Validate Uses

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

Validate validates the fields

type NewDingtalkHookForm Uses

type NewDingtalkHookForm struct {
    PayloadURL string `binding:"Required;ValidUrl"`
    WebhookForm
}

NewDingtalkHookForm form for creating dingtalk hook

func (*NewDingtalkHookForm) Validate Uses

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

Validate validates the fields

type NewDiscordHookForm Uses

type NewDiscordHookForm struct {
    PayloadURL string `binding:"Required;ValidUrl"`
    Username   string
    IconURL    string
    WebhookForm
}

NewDiscordHookForm form for creating discord hook

func (*NewDiscordHookForm) Validate Uses

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

Validate validates the fields

type NewGogshookForm Uses

type NewGogshookForm struct {
    PayloadURL  string `binding:"Required;ValidUrl"`
    ContentType int    `binding:"Required"`
    Secret      string
    WebhookForm
}

NewGogshookForm form for creating gogs hook

func (*NewGogshookForm) Validate Uses

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

Validate validates the fields

type NewMSTeamsHookForm Uses

type NewMSTeamsHookForm struct {
    PayloadURL string `binding:"Required;ValidUrl"`
    WebhookForm
}

NewMSTeamsHookForm form for creating MS Teams hook

func (*NewMSTeamsHookForm) Validate Uses

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

Validate validates the fields

type NewReleaseForm Uses

type NewReleaseForm struct {
    TagName    string `binding:"Required;GitRefName"`
    Target     string `form:"tag_target" binding:"Required"`
    Title      string `binding:"Required"`
    Content    string
    Draft      string
    Prerelease bool
    Files      []string
}

NewReleaseForm form for creating release

func (*NewReleaseForm) Validate Uses

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

Validate validates the fields

type NewSlackHookForm Uses

type NewSlackHookForm struct {
    PayloadURL string `binding:"Required;ValidUrl"`
    Channel    string `binding:"Required"`
    Username   string
    IconURL    string
    Color      string
    WebhookForm
}

NewSlackHookForm form for creating slack hook

func (NewSlackHookForm) HasInvalidChannel Uses

func (f NewSlackHookForm) HasInvalidChannel() bool

HasInvalidChannel validates the channel name is in the right format

func (*NewSlackHookForm) Validate Uses

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

Validate validates the fields

type NewTelegramHookForm Uses

type NewTelegramHookForm struct {
    BotToken string `binding:"Required"`
    ChatID   string `binding:"Required"`
    WebhookForm
}

NewTelegramHookForm form for creating telegram hook

func (*NewTelegramHookForm) Validate Uses

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

Validate validates the fields

type NewWebhookForm Uses

type NewWebhookForm struct {
    PayloadURL  string `binding:"Required;ValidUrl"`
    HTTPMethod  string `binding:"Required;In(POST,GET)"`
    ContentType int    `binding:"Required"`
    Secret      string
    WebhookForm
}

NewWebhookForm form for creating web hook

func (*NewWebhookForm) Validate Uses

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

Validate validates the fields

type NewWikiForm Uses

type NewWikiForm struct {
    Title   string `binding:"Required"`
    Content string `binding:"Required"`
    Message string
}

NewWikiForm form for creating wiki

func (*NewWikiForm) Validate Uses

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

Validate validates the fields FIXME: use code generation to generate this method.

type ProtectBranchForm Uses

type ProtectBranchForm struct {
    Protected               bool
    EnableWhitelist         bool
    WhitelistUsers          string
    WhitelistTeams          string
    WhitelistDeployKeys     bool
    EnableMergeWhitelist    bool
    MergeWhitelistUsers     string
    MergeWhitelistTeams     string
    EnableStatusCheck       bool `xorm:"NOT NULL DEFAULT false"`
    StatusCheckContexts     []string
    RequiredApprovals       int64
    ApprovalsWhitelistUsers string
    ApprovalsWhitelistTeams string
}

ProtectBranchForm form for changing protected branch settings

func (*ProtectBranchForm) Validate Uses

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

Validate validates the fields

type ReactionForm Uses

type ReactionForm struct {
    Content string `binding:"Required;In(+1,-1,laugh,confused,heart,hooray)"`
}

ReactionForm form for adding and removing reaction

func (*ReactionForm) Validate Uses

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

Validate validates the fields

type RegisterForm Uses

type RegisterForm struct {
    UserName           string `binding:"Required;AlphaDashDot;MaxSize(40)"`
    Email              string `binding:"Required;Email;MaxSize(254)"`
    Password           string `binding:"MaxSize(255)"`
    Retype             string
    GRecaptchaResponse string `form:"g-recaptcha-response"`
}

RegisterForm form for registering

func (RegisterForm) IsEmailDomainWhitelisted Uses

func (f RegisterForm) IsEmailDomainWhitelisted() bool

IsEmailDomainWhitelisted validates that the email address provided by the user matches what has been configured . If the domain whitelist from the config is empty, it marks the email as whitelisted

func (*RegisterForm) Validate Uses

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

Validate valideates the fields

type RemoveUploadFileForm Uses

type RemoveUploadFileForm struct {
    File string `binding:"Required;MaxSize(50)"`
}

RemoveUploadFileForm form for removing uploaded file

func (*RemoveUploadFileForm) Validate Uses

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

Validate validates the fields

type RepoSettingForm Uses

type RepoSettingForm struct {
    RepoName       string `binding:"Required;AlphaDashDot;MaxSize(100)"`
    Description    string `binding:"MaxSize(255)"`
    Website        string `binding:"ValidUrl;MaxSize(255)"`
    Interval       string
    MirrorAddress  string
    MirrorUsername string
    MirrorPassword string
    Private        bool
    Template       bool
    EnablePrune    bool

    // Advanced settings
    EnableWiki                       bool
    EnableExternalWiki               bool
    ExternalWikiURL                  string
    EnableIssues                     bool
    EnableExternalTracker            bool
    ExternalTrackerURL               string
    TrackerURLFormat                 string
    TrackerIssueStyle                string
    EnablePulls                      bool
    PullsIgnoreWhitespace            bool
    PullsAllowMerge                  bool
    PullsAllowRebase                 bool
    PullsAllowRebaseMerge            bool
    PullsAllowSquash                 bool
    EnableTimetracker                bool
    AllowOnlyContributorsToTrackTime bool
    EnableIssueDependencies          bool
    IsArchived                       bool

    // Admin settings
    EnableHealthCheck                     bool
    EnableCloseIssuesViaCommitInAnyBranch bool
}

RepoSettingForm form for changing repository settings

func (*RepoSettingForm) Validate Uses

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

Validate validates the fields

type SaveTopicForm Uses

type SaveTopicForm struct {
    Topics []string `binding:"topics;Required;"`
}

SaveTopicForm form for save topics for repository

type SignInForm Uses

type SignInForm struct {
    UserName string `binding:"Required;MaxSize(254)"`
    // TODO remove required from password for SecondFactorAuthentication
    Password string `binding:"Required;MaxSize(255)"`
    Remember bool
}

SignInForm form for signing in with user/password

func (*SignInForm) Validate Uses

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

Validate valideates the fields

type SignInOpenIDForm Uses

type SignInOpenIDForm struct {
    Openid   string `binding:"Required;MaxSize(256)"`
    Remember bool
}

SignInOpenIDForm form for signing in with OpenID

func (*SignInOpenIDForm) Validate Uses

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

Validate valideates the fields

type SignUpOpenIDForm Uses

type SignUpOpenIDForm struct {
    UserName           string `binding:"Required;AlphaDashDot;MaxSize(40)"`
    Email              string `binding:"Required;Email;MaxSize(254)"`
    GRecaptchaResponse string `form:"g-recaptcha-response"`
}

SignUpOpenIDForm form for signin up with OpenID

func (*SignUpOpenIDForm) Validate Uses

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

Validate valideates the fields

type SubmitReviewForm Uses

type SubmitReviewForm struct {
    Content string
    Type    string `binding:"Required;In(approve,comment,reject)"`
}

SubmitReviewForm for submitting a finished code review

func (SubmitReviewForm) HasEmptyContent Uses

func (f SubmitReviewForm) HasEmptyContent() bool

HasEmptyContent checks if the content of the review form is empty.

func (SubmitReviewForm) ReviewType Uses

func (f SubmitReviewForm) ReviewType() models.ReviewType

ReviewType will return the corresponding reviewtype for type

func (*SubmitReviewForm) Validate Uses

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

Validate validates the fields

type TwoFactorAuthForm Uses

type TwoFactorAuthForm struct {
    Passcode string `binding:"Required"`
}

TwoFactorAuthForm for logging in with 2FA token.

func (*TwoFactorAuthForm) Validate Uses

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

Validate validates the fields

type TwoFactorScratchAuthForm Uses

type TwoFactorScratchAuthForm struct {
    Token string `binding:"Required"`
}

TwoFactorScratchAuthForm for logging in with 2FA scratch token.

func (*TwoFactorScratchAuthForm) Validate Uses

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

Validate valideates the fields

type U2FDeleteForm Uses

type U2FDeleteForm struct {
    ID int64 `binding:"Required"`
}

U2FDeleteForm for deleting U2F keys

func (*U2FDeleteForm) Validate Uses

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

Validate valideates the fields

type U2FRegistrationForm Uses

type U2FRegistrationForm struct {
    Name string `binding:"Required"`
}

U2FRegistrationForm for reserving an U2F name

func (*U2FRegistrationForm) Validate Uses

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

Validate valideates the fields

type UpdateOrgSettingForm Uses

type UpdateOrgSettingForm struct {
    Name                      string `binding:"Required;AlphaDashDot;MaxSize(40)" locale:"org.org_name_holder"`
    FullName                  string `binding:"MaxSize(100)"`
    Description               string `binding:"MaxSize(255)"`
    Website                   string `binding:"ValidUrl;MaxSize(255)"`
    Location                  string `binding:"MaxSize(50)"`
    Visibility                structs.VisibleType
    MaxRepoCreation           int
    RepoAdminChangeTeamAccess bool
}

UpdateOrgSettingForm form for updating organization settings

func (*UpdateOrgSettingForm) Validate Uses

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

Validate validates the fields

type UpdateProfileForm Uses

type UpdateProfileForm struct {
    Name             string `binding:"AlphaDashDot;MaxSize(40)"`
    FullName         string `binding:"MaxSize(100)"`
    Email            string `binding:"Required;Email;MaxSize(254)"`
    KeepEmailPrivate bool
    Website          string `binding:"ValidUrl;MaxSize(255)"`
    Location         string `binding:"MaxSize(50)"`
    Language         string `binding:"Size(5)"`
    Description      string `binding:"MaxSize(255)"`
}

UpdateProfileForm form for updating profile

func (*UpdateProfileForm) Validate Uses

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

Validate validates the fields

type UpdateThemeForm Uses

type UpdateThemeForm struct {
    Theme string `binding:"Required;MaxSize(30)"`
}

UpdateThemeForm form for updating a users' theme

func (UpdateThemeForm) IsThemeExists Uses

func (f UpdateThemeForm) IsThemeExists() bool

IsThemeExists checks if the theme is a theme available in the config.

func (*UpdateThemeForm) Validate Uses

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

Validate validates the field

type UploadRepoFileForm Uses

type UploadRepoFileForm struct {
    TreePath      string `binding:"MaxSize(500)"`
    CommitSummary string `binding:"MaxSize(100)"`
    CommitMessage string
    CommitChoice  string `binding:"Required;MaxSize(50)"`
    NewBranchName string `binding:"GitRefName;MaxSize(100)"`
    Files         []string
}

UploadRepoFileForm form for uploading repository file

func (*UploadRepoFileForm) Validate Uses

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

Validate validates the fields

type WebhookForm Uses

type WebhookForm struct {
    Events       string
    Create       bool
    Delete       bool
    Fork         bool
    Issues       bool
    IssueComment bool
    Release      bool
    Push         bool
    PullRequest  bool
    Repository   bool
    Active       bool
    BranchFilter string `binding:"GlobPattern"`
}

WebhookForm form for changing web hook

func (WebhookForm) ChooseEvents Uses

func (f WebhookForm) ChooseEvents() bool

ChooseEvents if the hook will be triggered choose events

func (WebhookForm) PushOnly Uses

func (f WebhookForm) PushOnly() bool

PushOnly if the hook will be triggered when push

func (WebhookForm) SendEverything Uses

func (f WebhookForm) SendEverything() bool

SendEverything if the hook will be triggered any event

Directories

PathSynopsis
ldapPackage 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
oauth2
openid
pam

Package auth imports 18 packages (graph) and is imported by 64 packages. Updated 2019-11-20. Refresh now. Tools for package owners.