feat: config variables for password requirements; feat: util function for validating passwords
46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
package models
|
|
|
|
type Tokens struct {
|
|
AccessToken string `json:"access_token"`
|
|
RefreshToken string `json:"refresh_token"`
|
|
}
|
|
|
|
type RegistrationBeginRequest struct {
|
|
Username string `json:"username" binding:"required,min=3,max=20"`
|
|
Email *string `json:"email" binding:"email"`
|
|
Password string `json:"password" binding:"required,password"` // TODO: password checking
|
|
}
|
|
|
|
// TODO: length check
|
|
type RegistrationCompleteRequest struct {
|
|
Username string `json:"username" binding:"required"`
|
|
VerificationCode string `json:"verification_code" binding:"required"`
|
|
Name string `json:"name" binding:"required,max=75"`
|
|
Birthday *string `json:"birthday"`
|
|
AvatarUrl *string `json:"avatar_url" binding:"http_url,max=255"`
|
|
}
|
|
|
|
type RegistrationCompleteResponse struct {
|
|
Tokens
|
|
}
|
|
|
|
// TODO: length check
|
|
type LoginRequest struct {
|
|
Username string `json:"username" binding:"required"`
|
|
Password string `json:"password" binding:"required"`
|
|
TOTP *string `json:"totp"`
|
|
}
|
|
|
|
type LoginResponse struct {
|
|
Tokens
|
|
}
|
|
|
|
// TODO: length check
|
|
type RefreshRequest struct {
|
|
RefreshToken string `json:"refresh_token" binding:"required"`
|
|
}
|
|
|
|
type RefreshResponse struct {
|
|
Tokens
|
|
}
|