File tree Expand file tree Collapse file tree 8 files changed +26
-0
lines changed Expand file tree Collapse file tree 8 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,7 @@ pub fn site_config_from_config(
207
207
&& account_config. password_change_allowed ,
208
208
account_recovery_allowed : password_config. enabled ( )
209
209
&& account_config. password_recovery_enabled ,
210
+ account_deactivation_allowed : account_config. account_deactivation_allowed ,
210
211
captcha,
211
212
minimum_password_complexity : password_config. minimum_complexity ( ) ,
212
213
session_expiration,
Original file line number Diff line number Diff line change @@ -61,6 +61,11 @@ pub struct AccountConfig {
61
61
/// This has no effect if password login is disabled.
62
62
#[ serde( default = "default_false" , skip_serializing_if = "is_default_false" ) ]
63
63
pub password_recovery_enabled : bool ,
64
+
65
+ /// Whether users are allowed to delete their own account. Defaults to
66
+ /// `false`.
67
+ #[ serde( default = "default_false" , skip_serializing_if = "is_default_false" ) ]
68
+ pub account_deactivation_allowed : bool ,
64
69
}
65
70
66
71
impl Default for AccountConfig {
@@ -71,6 +76,7 @@ impl Default for AccountConfig {
71
76
password_registration_enabled : default_false ( ) ,
72
77
password_change_allowed : default_true ( ) ,
73
78
password_recovery_enabled : default_false ( ) ,
79
+ account_deactivation_allowed : default_false ( ) ,
74
80
}
75
81
}
76
82
}
@@ -83,6 +89,7 @@ impl AccountConfig {
83
89
&& is_default_true ( & self . displayname_change_allowed )
84
90
&& is_default_true ( & self . password_change_allowed )
85
91
&& is_default_false ( & self . password_recovery_enabled )
92
+ && is_default_false ( & self . account_deactivation_allowed )
86
93
}
87
94
}
88
95
Original file line number Diff line number Diff line change @@ -76,6 +76,9 @@ pub struct SiteConfig {
76
76
/// Whether users can recover their account via email.
77
77
pub account_recovery_allowed : bool ,
78
78
79
+ /// Whether users can delete their own account.
80
+ pub account_deactivation_allowed : bool ,
81
+
79
82
/// Captcha configuration
80
83
pub captcha : Option < CaptchaConfig > ,
81
84
Original file line number Diff line number Diff line change @@ -46,6 +46,9 @@ pub struct SiteConfig {
46
46
/// Whether passwords are enabled and users can register using a password.
47
47
password_registration_enabled : bool ,
48
48
49
+ /// Whether users can delete their own account.
50
+ account_deactivation_allowed : bool ,
51
+
49
52
/// Minimum password complexity, from 0 to 4, in terms of a zxcvbn score.
50
53
/// The exact scorer (including dictionaries and other data tables)
51
54
/// in use is <https://crates.io/crates/zxcvbn>.
@@ -93,6 +96,7 @@ impl SiteConfig {
93
96
password_login_enabled : data_model. password_login_enabled ,
94
97
password_change_allowed : data_model. password_change_allowed ,
95
98
password_registration_enabled : data_model. password_registration_enabled ,
99
+ account_deactivation_allowed : data_model. account_deactivation_allowed ,
96
100
minimum_password_complexity : data_model. minimum_password_complexity ,
97
101
}
98
102
}
Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ pub fn test_site_config() -> SiteConfig {
137
137
displayname_change_allowed : true ,
138
138
password_change_allowed : true ,
139
139
account_recovery_allowed : true ,
140
+ account_deactivation_allowed : true ,
140
141
captcha : None ,
141
142
minimum_password_complexity : 1 ,
142
143
session_expiration : None ,
Original file line number Diff line number Diff line change 2463
2463
"password_recovery_enabled" : {
2464
2464
"description" : " Whether email-based password recovery is enabled. Defaults to `false`.\n\n This has no effect if password login is disabled." ,
2465
2465
"type" : " boolean"
2466
+ },
2467
+ "account_deactivation_allowed" : {
2468
+ "description" : " Whether users are allowed to delete their own account. Defaults to `false`." ,
2469
+ "type" : " boolean"
2466
2470
}
2467
2471
}
2468
2472
},
Original file line number Diff line number Diff line change @@ -1599,6 +1599,10 @@ type SiteConfig implements Node {
1599
1599
"""
1600
1600
passwordRegistrationEnabled : Boolean !
1601
1601
"""
1602
+ Whether users can delete their own account.
1603
+ """
1604
+ accountDeactivationAllowed : Boolean !
1605
+ """
1602
1606
Minimum password complexity, from 0 to 4, in terms of a zxcvbn score.
1603
1607
The exact scorer (including dictionaries and other data tables)
1604
1608
in use is <https://crates.io/crates/zxcvbn>.
Original file line number Diff line number Diff line change @@ -1161,6 +1161,8 @@ export type SetPrimaryEmailStatus =
1161
1161
1162
1162
export type SiteConfig = Node & {
1163
1163
__typename ?: 'SiteConfig' ;
1164
+ /** Whether users can delete their own account. */
1165
+ accountDeactivationAllowed : Scalars [ 'Boolean' ] [ 'output' ] ;
1164
1166
/** The configuration of CAPTCHA provider. */
1165
1167
captchaConfig ?: Maybe < CaptchaConfig > ;
1166
1168
/** Whether users can change their display name. */
You can’t perform that action at this time.
0 commit comments