@@ -29,6 +29,52 @@ pub struct LoginRequest {
2929 pub captcha_answer : String ,
3030}
3131
32+ /// Self-service registration payload. Submitted by the public `/register` page.
33+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
34+ pub struct RegisterRequest {
35+ pub username : String ,
36+ pub display_name : Option < String > ,
37+ pub email : String ,
38+ pub password : String ,
39+ pub confirm_password : String ,
40+ pub captcha_token : String ,
41+ pub captcha_answer : String ,
42+ /// Optional profile fields mirrors the admin create form.
43+ #[ serde( default ) ]
44+ pub phone : Option < String > ,
45+ #[ serde( default ) ]
46+ pub department : Option < String > ,
47+ #[ serde( default ) ]
48+ pub title : Option < String > ,
49+ }
50+
51+ /// Returned by `/api/v1/auth/register`. Tells the client what happened so the
52+ /// UI can show the right next-step message.
53+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
54+ #[ serde( rename_all = "snake_case" , tag = "outcome" ) ]
55+ pub enum RegisterResponse {
56+ /// Self-registration is disabled on this platform.
57+ Closed ,
58+ /// Account is active and the user may log in now.
59+ Active {
60+ username : String ,
61+ display_name : String ,
62+ } ,
63+ /// Account was created but is pending admin approval.
64+ Pending {
65+ username : String ,
66+ display_name : String ,
67+ } ,
68+ }
69+
70+ /// Public endpoint that tells the register/login pages which flow to render.
71+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
72+ pub struct RegistrationPolicyResponse {
73+ /// `closed` | `auto` | `approval`
74+ pub mode : String ,
75+ pub self_service_enabled : bool ,
76+ }
77+
3278#[ derive( Debug , Clone , Serialize , Deserialize ) ]
3379pub struct CaptchaResponse {
3480 pub token : String ,
@@ -100,6 +146,8 @@ pub struct AdminUserResponse {
100146 pub department : Option < String > ,
101147 pub title : Option < String > ,
102148 pub disabled : bool ,
149+ /// `active` | `pending` | `rejected` | `disabled`
150+ pub status : String ,
103151 pub last_login_at : Option < DateTime < Utc > > ,
104152 pub created_at : DateTime < Utc > ,
105153 pub updated_at : DateTime < Utc > ,
@@ -566,6 +614,7 @@ pub struct SiteSettingsResponse {
566614 pub announcement : Option < String > ,
567615 pub maintenance_mode : bool ,
568616 pub self_service_enabled : bool ,
617+ pub registration_mode : String ,
569618 pub default_lease_minutes : i64 ,
570619 pub max_lease_minutes : i64 ,
571620 pub support_email : Option < String > ,
@@ -582,6 +631,7 @@ pub struct SiteSettingsUpdateRequest {
582631 pub announcement : Option < String > ,
583632 pub maintenance_mode : bool ,
584633 pub self_service_enabled : bool ,
634+ pub registration_mode : String ,
585635 pub default_lease_minutes : i64 ,
586636 pub max_lease_minutes : i64 ,
587637 pub support_email : Option < String > ,
0 commit comments