-use crate::{captcha_espeak_wav_base64, Perform};
+use crate::{captcha_as_wav_base64, Perform};
use actix_web::web::Data;
use anyhow::Context;
use bcrypt::verify;
let answer = captcha.chars_as_string();
- let png_byte_array = captcha.as_png().expect("failed to generate captcha");
-
- let png = base64::encode(png_byte_array);
+ let png = captcha.as_base64().expect("failed to generate captcha");
let uuid = uuid::Uuid::new_v4().to_string();
- let wav = captcha_espeak_wav_base64(&answer).ok();
+ let wav = captcha_as_wav_base64(&captcha);
let captcha_item = CaptchaItem {
answer,
context.chat_server().do_send(captcha_item);
Ok(GetCaptchaResponse {
- ok: Some(CaptchaResponse { png, uuid, wav }),
+ ok: Some(CaptchaResponse { png, wav, uuid }),
})
}
}
actor_id: None,
bio,
local: None,
+ admin: None,
private_key: None,
public_key: None,
last_refreshed_at: None,
shared_inbox_url: None,
+ matrix_user_id,
};
let person_res = blocking(context.pool(), move |conn| {
let local_user_form = LocalUserForm {
person_id,
email,
- matrix_user_id,
password_encrypted,
- admin: None,
show_nsfw: data.show_nsfw,
+ show_scores: data.show_scores,
theme: data.theme.to_owned(),
default_sort_type,
default_listing_type,
let added = data.added;
let added_person_id = data.person_id;
let added_admin = match blocking(context.pool(), move |conn| {
- LocalUser::add_admin(conn, added_person_id, added)
+ Person::add_admin(conn, added_person_id, added)
})
.await?
{
// Mod tables
let form = ModAddForm {
mod_person_id: local_user_view.person.id,
- other_person_id: added_admin.person_id,
+ other_person_id: added_admin.id,
removed: Some(!data.added),
};
}
// Mod tables
- let expires = match data.expires {
- Some(time) => Some(naive_from_unix(time)),
- None => None,
- };
+ let expires = data.expires.map(naive_from_unix);
let form = ModBanForm {
mod_person_id: local_user_view.person.id,