2023-05-20 20:15:57 +02:00
|
|
|
// Copyright 2023 wanderer <a_mirre at utb dot cz>
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2023-05-15 23:57:38 +02:00
|
|
|
package handlers
|
|
|
|
|
|
|
|
type userSignin struct {
|
2023-09-04 12:21:58 +02:00
|
|
|
Username string `form:"username" json:"username" validate:"required,username,gte=2"`
|
|
|
|
Password string `form:"password" json:"password" validate:"required,password,gte=12"`
|
2023-05-15 23:57:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type userSignup struct {
|
2023-09-04 12:21:58 +02:00
|
|
|
Username string `form:"username" json:"username" validate:"required,username,gte=2"`
|
2023-05-28 18:57:37 +02:00
|
|
|
Email string `form:"email" json:"email" validate:"required,email"`
|
2023-09-04 12:21:58 +02:00
|
|
|
Password string `form:"password" json:"password" validate:"required,password,gte=20"`
|
2023-05-15 23:57:38 +02:00
|
|
|
}
|
2023-05-22 06:47:33 +02:00
|
|
|
|
2023-08-24 18:43:24 +02:00
|
|
|
// this struct is also used on update by admins, which is why the password fields are omitempty.
|
|
|
|
// when users finish setting up, admins can no longer change their passwords.
|
2023-05-22 06:47:33 +02:00
|
|
|
type userCreate struct {
|
2023-09-04 12:21:58 +02:00
|
|
|
Username string `form:"username" json:"username" validate:"required,username,gte=2"`
|
2023-05-22 06:47:33 +02:00
|
|
|
Email string `form:"email" json:"email" validate:"required,email"`
|
2023-09-04 12:21:58 +02:00
|
|
|
Password string `form:"password" json:"password" validate:"omitempty,password,gte=20"`
|
|
|
|
RepeatPassword string `form:"repeatPassword" json:"repeatPassword" validate:"omitempty,repeatPassword,gte=20"`
|
2023-05-22 06:47:33 +02:00
|
|
|
IsAdmin bool `form:"isAdmin" json:"isAdmin" validate:"required,isAdmin"`
|
|
|
|
IsActive *bool `form:"isActive" json:"isActive" validate:"omitempty,isActive"`
|
|
|
|
}
|
2023-05-29 22:42:18 +02:00
|
|
|
|
|
|
|
type userID struct {
|
|
|
|
ID string `param:"id" validate:"required,id"`
|
|
|
|
}
|
2023-08-24 18:43:24 +02:00
|
|
|
|
|
|
|
type initPasswordChange struct {
|
2023-09-04 12:21:58 +02:00
|
|
|
NewPassword string `form:"new-password" validate:"required,new-password,gte=20"`
|
2023-08-24 18:43:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type hibpSearch struct {
|
2023-09-04 12:21:58 +02:00
|
|
|
Account string `form:"search" validate:"required,search,gt=2"`
|
2023-08-24 18:43:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type hibpBreachDetail struct {
|
2023-09-04 12:21:58 +02:00
|
|
|
BreachName string `param:"name" validate:"required,name,gt=0"`
|
2023-08-24 18:43:24 +02:00
|
|
|
}
|