surtur
6b45213649
All checks were successful
continuous-integration/drone/push Build is passing
* add user onboarding workflow * fix user editing (no edits of passwords of regular users after onboarding) * refresh HIBP breach cache in DB on app start-up * display HIBP breach details * fix request scheduling to prevent panics (this still needs some love..) * fix middleware auth * add TODOs * update head.tmpl * reword some error messages
43 lines
1.6 KiB
Go
43 lines
1.6 KiB
Go
// Copyright 2023 wanderer <a_mirre at utb dot cz>
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
package handlers
|
|
|
|
type userSignin struct {
|
|
Username string `form:"username" json:"username" validate:"required,username"`
|
|
Password string `form:"password" json:"password" validate:"required,password"`
|
|
}
|
|
|
|
type userSignup struct {
|
|
Username string `form:"username" json:"username" validate:"required,username"`
|
|
Email string `form:"email" json:"email" validate:"required,email"`
|
|
Password string `form:"password" json:"password" validate:"required,password"`
|
|
}
|
|
|
|
// 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.
|
|
type userCreate struct {
|
|
Username string `form:"username" json:"username" validate:"required,username"`
|
|
Email string `form:"email" json:"email" validate:"required,email"`
|
|
Password string `form:"password" json:"password" validate:"omitempty,password"`
|
|
RepeatPassword string `form:"repeatPassword" json:"repeatPassword" validate:"omitempty,repeatPassword"`
|
|
IsAdmin bool `form:"isAdmin" json:"isAdmin" validate:"required,isAdmin"`
|
|
IsActive *bool `form:"isActive" json:"isActive" validate:"omitempty,isActive"`
|
|
}
|
|
|
|
type userID struct {
|
|
ID string `param:"id" validate:"required,id"`
|
|
}
|
|
|
|
type initPasswordChange struct {
|
|
NewPassword string `form:"new-password" validate:"required,new-password"`
|
|
}
|
|
|
|
type hibpSearch struct {
|
|
Account string `form:"search" validate:"required,search"`
|
|
}
|
|
|
|
type hibpBreachDetail struct {
|
|
BreachName string `param:"name" validate:"required,name"`
|
|
}
|