use crate::{
newtypes::LocalUserId,
- schema::local_user::dsl::*,
+ schema::local_user::dsl::{
+ accepted_application,
+ email_verified,
+ local_user,
+ password_encrypted,
+ validator_time,
+ },
source::{
actor_language::{LocalUserLanguage, SiteLanguage},
local_user::{LocalUser, LocalUserInsertForm, LocalUserUpdateForm},
utils::{get_conn, naive_now, DbPool},
};
use bcrypt::{hash, DEFAULT_COST};
-use diesel::{dsl::*, result::Error, ExpressionMethods, QueryDsl};
+use diesel::{dsl::insert_into, result::Error, ExpressionMethods, QueryDsl};
use diesel_async::RunQueryDsl;
-mod safe_settings_type {
- use crate::{
- schema::local_user::columns::*,
- source::local_user::LocalUser,
- traits::ToSafeSettings,
- };
-
- type Columns = (
- id,
- person_id,
- email,
- show_nsfw,
- theme,
- default_sort_type,
- default_listing_type,
- interface_language,
- show_avatars,
- send_notifications_to_email,
- validator_time,
- show_bot_accounts,
- show_scores,
- show_read_posts,
- show_new_post_notifs,
- email_verified,
- accepted_application,
- );
-
- impl ToSafeSettings for LocalUser {
- type SafeSettingsColumns = Columns;
-
- /// Includes everything but the hashed password
- fn safe_settings_columns_tuple() -> Self::SafeSettingsColumns {
- (
- id,
- person_id,
- email,
- show_nsfw,
- theme,
- default_sort_type,
- default_listing_type,
- interface_language,
- show_avatars,
- send_notifications_to_email,
- validator_time,
- show_bot_accounts,
- show_scores,
- show_read_posts,
- show_new_post_notifs,
- email_verified,
- accepted_application,
- )
- }
- }
-}
-
impl LocalUser {
pub async fn update_password(
pool: &DbPool,