mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2024-11-26 07:34:25 +00:00
feat: handle inhibit_login in /register
This commit is contained in:
parent
acc7b15981
commit
0616acbde6
|
@ -121,6 +121,28 @@ pub fn register_route(
|
|||
// Create user
|
||||
db.users.create(&user_id, &password)?;
|
||||
|
||||
// Initial data
|
||||
db.account_data.update(
|
||||
None,
|
||||
&user_id,
|
||||
EventType::PushRules,
|
||||
&ruma::events::push_rules::PushRulesEvent {
|
||||
content: ruma::events::push_rules::PushRulesEventContent {
|
||||
global: crate::push_rules::default_pushrules(&user_id),
|
||||
},
|
||||
},
|
||||
&db.globals,
|
||||
)?;
|
||||
|
||||
if body.inhibit_login {
|
||||
return Ok(register::Response {
|
||||
access_token: None,
|
||||
user_id,
|
||||
device_id: None,
|
||||
}
|
||||
.into());
|
||||
}
|
||||
|
||||
// Generate new device id if the user didn't specify one
|
||||
let device_id = body
|
||||
.device_id
|
||||
|
@ -138,19 +160,6 @@ pub fn register_route(
|
|||
body.initial_device_display_name.clone(),
|
||||
)?;
|
||||
|
||||
// Initial data
|
||||
db.account_data.update(
|
||||
None,
|
||||
&user_id,
|
||||
EventType::PushRules,
|
||||
&ruma::events::push_rules::PushRulesEvent {
|
||||
content: ruma::events::push_rules::PushRulesEventContent {
|
||||
global: crate::push_rules::default_pushrules(&user_id),
|
||||
},
|
||||
},
|
||||
&db.globals,
|
||||
)?;
|
||||
|
||||
Ok(register::Response {
|
||||
access_token: Some(token),
|
||||
user_id,
|
||||
|
|
Loading…
Reference in a new issue