Remove name field (and remove existing data) (#935)

* Remove name field (and remove existing data)

* run prep, fmt

* fix dummy data
This commit is contained in:
Geometrically
2024-09-06 20:16:28 -07:00
committed by GitHub
parent 637a923e84
commit 2e35f3608b
14 changed files with 67 additions and 133 deletions

View File

@@ -65,7 +65,6 @@ pub struct TempUser {
pub avatar_url: Option<String>,
pub bio: Option<String>,
pub name: Option<String>,
pub country: Option<String>,
}
@@ -221,7 +220,6 @@ impl TempUser {
stripe_customer_id: None,
totp_secret: None,
username,
name: self.name,
email: self.email,
email_verified: true,
avatar_url,
@@ -578,7 +576,6 @@ impl AuthProvider {
email: github_user.email,
avatar_url: Some(github_user.avatar_url),
bio: github_user.bio,
name: github_user.name,
country: None,
}
}
@@ -610,7 +607,6 @@ impl AuthProvider {
.avatar
.map(|x| format!("https://cdn.discordapp.com/avatars/{}/{}.webp", id, x)),
bio: None,
name: discord_user.global_name,
country: None,
}
}
@@ -619,7 +615,6 @@ impl AuthProvider {
#[serde(rename_all = "camelCase")]
pub struct MicrosoftUser {
pub id: String,
pub display_name: Option<String>,
pub mail: Option<String>,
pub user_principal_name: String,
}
@@ -642,7 +637,6 @@ impl AuthProvider {
email: microsoft_user.mail,
avatar_url: None,
bio: None,
name: microsoft_user.display_name,
country: None,
}
}
@@ -672,7 +666,6 @@ impl AuthProvider {
email: gitlab_user.email,
avatar_url: gitlab_user.avatar_url,
bio: gitlab_user.bio,
name: gitlab_user.name,
country: None,
}
}
@@ -681,7 +674,6 @@ impl AuthProvider {
pub struct GoogleUser {
pub id: String,
pub email: String,
pub name: Option<String>,
pub picture: Option<String>,
}
@@ -705,7 +697,6 @@ impl AuthProvider {
email: Some(google_user.email),
avatar_url: google_user.picture,
bio: None,
name: google_user.name,
country: None,
}
}
@@ -725,7 +716,6 @@ impl AuthProvider {
#[derive(Deserialize)]
struct Player {
steamid: String,
personaname: String,
profileurl: String,
avatar: Option<String>,
}
@@ -757,7 +747,6 @@ impl AuthProvider {
email: None,
avatar_url: player.avatar,
bio: None,
name: Some(player.personaname),
country: None,
}
} else {
@@ -802,7 +791,6 @@ impl AuthProvider {
email: Some(paypal_user.email),
avatar_url: paypal_user.picture,
bio: None,
name: None,
country: Some(paypal_user.address.country),
}
}
@@ -1527,7 +1515,6 @@ pub async fn create_account_with_password(
stripe_customer_id: None,
totp_secret: None,
username: new_account.username.clone(),
name: Some(new_account.username),
email: Some(new_account.email.clone()),
email_verified: false,
avatar_url: None,
@@ -2068,11 +2055,7 @@ pub async fn change_password(
let update_password = if let Some(new_password) = &change_password.new_password {
let score = zxcvbn::zxcvbn(
new_password,
&[
&user.username,
&user.email.clone().unwrap_or_default(),
&user.name.unwrap_or_default(),
],
&[&user.username, &user.email.clone().unwrap_or_default()],
)?;
if score.score() < 3 {