summaryrefslogtreecommitdiff
path: root/internal/gtsmodel/admin.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-07-23 12:33:17 +0200
committerLibravatar GitHub <noreply@github.com>2023-07-23 12:33:17 +0200
commit5a29a031adbcaca85ad641bf74254d3ea985d03c (patch)
treeeda06b4d3b09207bc6d4dc6e9e659e8f283028dc /internal/gtsmodel/admin.go
parent[feature] Report Masto version in /api/v1/instance (#1977) (diff)
downloadgotosocial-5a29a031adbcaca85ad641bf74254d3ea985d03c.tar.xz
[chore] Admin CLI + new account creation refactoring (#2008)
* set maxPasswordLength to 72 bytes, rename validate function * refactor NewSignup * refactor admin account CLI commands * refactor oidc create user * refactor processor create * tweak password change, check old != new password
Diffstat (limited to 'internal/gtsmodel/admin.go')
-rw-r--r--internal/gtsmodel/admin.go25
1 files changed, 24 insertions, 1 deletions
diff --git a/internal/gtsmodel/admin.go b/internal/gtsmodel/admin.go
index f6f32a9a3..22a38f32c 100644
--- a/internal/gtsmodel/admin.go
+++ b/internal/gtsmodel/admin.go
@@ -17,7 +17,10 @@
package gtsmodel
-import "time"
+import (
+ "net"
+ "time"
+)
// AdminAccountAction models an action taken by an instance administrator on an account.
type AdminAccountAction struct {
@@ -45,3 +48,23 @@ const (
// AdminActionSuspend -- the account or application etc has been deleted.
AdminActionSuspend AdminActionType = "suspend"
)
+
+// NewSignup models parameters for the creation
+// of a new user + account on this instance.
+//
+// Aside from username, email, and password, it is
+// fine to use zero values on fields of this struct.
+type NewSignup struct {
+ Username string // Username of the new account.
+ Email string // Email address of the user.
+ Password string // Plaintext (not yet hashed) password for the user.
+
+ Reason string // Reason given by the user when submitting a sign up request (optional).
+ PreApproved bool // Mark the new user/account as preapproved (optional)
+ SignUpIP net.IP // IP address from which the sign up request occurred (optional).
+ Locale string // Locale code for the new account/user (optional).
+ AppID string // ID of the application used to create this account (optional).
+ EmailVerified bool // Mark submitted email address as already verified (optional).
+ ExternalID string // ID of this user in external OIDC system (optional).
+ Admin bool // Mark new user as an admin user (optional).
+}