feat: make it possible to automatically join user to a guild on registration
This commit is contained in:
parent
6eb47fdb36
commit
19f64d413c
2 changed files with 14 additions and 11 deletions
|
@ -12,17 +12,11 @@ use uuid::Uuid;
|
|||
|
||||
use super::Response;
|
||||
use crate::{
|
||||
Data,
|
||||
error::Error,
|
||||
schema::{
|
||||
access_tokens::{self, dsl as adsl},
|
||||
refresh_tokens::{self, dsl as rdsl},
|
||||
users::{self, dsl as udsl},
|
||||
},
|
||||
utils::{
|
||||
EMAIL_REGEX, PASSWORD_REGEX, USERNAME_REGEX, generate_token,
|
||||
new_refresh_token_cookie,
|
||||
},
|
||||
error::Error, objects::Member, schema::{
|
||||
access_tokens::{self, dsl as adsl}, refresh_tokens::{self, dsl as rdsl}, users::{self, dsl as udsl}
|
||||
}, utils::{
|
||||
generate_token, new_refresh_token_cookie, EMAIL_REGEX, PASSWORD_REGEX, USERNAME_REGEX
|
||||
}, Data
|
||||
};
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
@ -145,6 +139,10 @@ pub async fn res(
|
|||
.execute(&mut conn)
|
||||
.await?;
|
||||
|
||||
if let Some(initial_guild) = data.config.instance.initial_guild {
|
||||
Member::new(&data, uuid, initial_guild).await?;
|
||||
}
|
||||
|
||||
return Ok(HttpResponse::Ok()
|
||||
.cookie(new_refresh_token_cookie(&data.config, refresh_token))
|
||||
.json(Response { access_token }));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue