userValidator

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmailValidation

func EmailValidation(email string) bool

EmailValidation : Check if an email is valid

func IsAgreed

func IsAgreed(termsAndConditions string) bool

IsAgreed : Check if terms and conditions are valid

func ValidateUsername

func ValidateUsername(username string) bool

ValidateUsername : Check if a username is valid

Types

type LoginForm

type LoginForm struct {
	Username   string `validate:"required" json:"username" form:"username"`
	Password   string `validate:"required" json:"password" form:"password"`
	RedirectTo string `validate:"-" form:"redirectTo" json:"omitempty"`
}

LoginForm is used when a user logs in.

type PasswordForm

type PasswordForm struct {
	CurrentPassword string `validate:"required" form:"current_password"`
	Password        string `validate:"required" form:"password"`
}

PasswordForm is used when updating a user password.

type PasswordResetForm

type PasswordResetForm struct {
	PasswordResetToken string `validate:"required" form:"token"`
	Password           string `validate:"required" form:"password"`
}

PasswordResetForm is used when reseting a password.

type RegistrationForm

type RegistrationForm struct {
	Username           string `validate:"required,min=3,max=20" form:"username" json:"username"`
	Email              string `form:"email" json:"email"`
	Password           string `validate:"required,min=6,max=72,eqfield=ConfirmPassword" form:"password" json:"password"`
	ConfirmPassword    string `validate:"required" omit:"true" form:"password_confirmation" json:"password_confirmation"` // Omit when binding to user model since user model doesn't have those field
	CaptchaID          string `validate:"required" omit:"true" form:"captchaID" json:"captchaID"`
	TermsAndConditions string `validate:"eq=1" omit:"true" form:"t_and_c" json:"t_and_c"`
}

RegistrationForm is used when creating a user.

type SendPasswordResetForm

type SendPasswordResetForm struct {
	Email string `validate:"required" form:"email"`
}

SendPasswordResetForm is used when sending a password reset token.

type UserForm

type UserForm struct {
	Username        string `validate:"required" form:"username" json:"username" needed:"true" len_min:"3" len_max:"20"`
	Email           string `json:"email" form:"email"`
	Language        string `validate:"default=en-us" form:"language" json:"language"`
	CurrentPassword string `validate:"omitempty,min=6,max=72" form:"current_password" json:"current_password" omit:"true"`
	Password        string `validate:"omitempty,min=6,max=72" form:"password" json:"password" len_min:"6" len_max:"72" equalInput:"ConfirmPassword"`
	ConfirmPassword string `validate:"omitempty" form:"password_confirmation" json:"password_confirmation" omit:"true"`
	Status          int    `validate:"default=0" form:"status" json:"status"`
	Theme           string `form:"theme" json:"theme"`
}

UserForm is used when updating a user.

type UserSettingsForm

type UserSettingsForm struct {
	NewTorrent        bool `validate:"-" json:"new_torrent" form:"new_torrent"`
	NewTorrentEmail   bool `validate:"-" json:"new_torrent_email" form:"new_torrent_email"`
	NewComment        bool `validate:"-" json:"new_comment" form:"new_comment"`
	NewCommentEmail   bool `validate:"-" json:"new_comment_email" form:"new_comment_email"`
	NewResponses      bool `validate:"-" json:"new_responses" form:"new_responses"`
	NewResponsesEmail bool `validate:"-" json:"new_responses_email" form:"new_responses_email"`
	NewFollower       bool `validate:"-" json:"new_follower" form:"new_follower"`
	NewFollowerEmail  bool `validate:"-" json:"new_follower_email" form:"new_follower_email"`
	Followed          bool `validate:"-" json:"followed" form:"followed"`
	FollowedEmail     bool `validate:"-" json:"followed_email" form:"followed_email"`
}

UserSettingsForm is used when updating a user.

Jump to

Keyboard shortcuts

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