add: user follows, user blocks, ip bans
TODO: implement user following API endpoints TODO: implement user blocking API endpoints TODO: don't allow blocked users to interact with the users who blocked them
This commit is contained in:
parent
81005a6e1c
commit
559ce19932
25 changed files with 628 additions and 127 deletions
|
@ -42,6 +42,11 @@ pub async fn register_request(
|
|||
.unwrap_or("")
|
||||
.to_string();
|
||||
|
||||
// check for ip ban
|
||||
if let Ok(_) = data.get_ipban_by_ip(&real_ip).await {
|
||||
return (None, Json(Error::NotAllowed.into()));
|
||||
}
|
||||
|
||||
// ...
|
||||
let mut user = User::new(props.username, props.password);
|
||||
let (initial_token, t) = User::create_token(&real_ip);
|
||||
|
@ -90,6 +95,11 @@ pub async fn login_request(
|
|||
.unwrap_or("")
|
||||
.to_string();
|
||||
|
||||
// check for ip ban
|
||||
if let Ok(_) = data.get_ipban_by_ip(&real_ip).await {
|
||||
return (None, Json(Error::NotAllowed.into()));
|
||||
}
|
||||
|
||||
// verify password
|
||||
let user = match data.get_user_by_username(&props.username).await {
|
||||
Ok(ua) => ua,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue