Add functionality for generating random NEX passwords

This commit is contained in:
red binder 2026-03-29 14:44:15 +02:00
commit 15129e8df3
5 changed files with 41 additions and 21 deletions

View file

@ -1,11 +1,8 @@
use std::env;
use std::io::Write;
use chrono::{NaiveDate, NaiveDateTime};
use gxhash::{gxhash32, gxhash64};
use once_cell::sync::Lazy;
use rocket::{get, post, put, State};
use rocket::serde::{Deserialize, Serialize};
use crate::account::account::{generate_password, Auth, User};
use crate::account::account::{Auth, User, generate_nex_password, generate_password};
use crate::dsresponse::Ds;
use crate::error::{Error, Errors};
use crate::nnid::pid_distribution::next_pid;
@ -14,8 +11,8 @@ use crate::Pool;
use crate::xml::{Xml, YesNoVal};
use crate::email::send_verification_email;
use rand::Rng;
use mii::{get_image_png, get_image_tga};
use std::sync::Arc;
// Not in use currently.
//use mii::{get_image_png, get_image_tga};
use crate::mii_util::get_mii_img_url;
const DATABASE_ERROR: Errors = Errors{
@ -152,6 +149,7 @@ pub async fn create_account(database: &State<Pool>, data: Xml<AccountCreationDat
let password = generate_password(pid, &password).ok_or(None)?;
let nex_password = generate_nex_password();
sqlx::query!("
INSERT INTO users (
@ -169,9 +167,10 @@ pub async fn create_account(database: &State<Pool>, data: Xml<AccountCreationDat
gender,
mii_data,
verification_code,
account_level
account_level,
nex_password
) VALUES (
$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15
$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16
)
",
pid,
@ -188,7 +187,8 @@ pub async fn create_account(database: &State<Pool>, data: Xml<AccountCreationDat
gender.as_ref(),
data.as_ref(),
verification_code,
account_level
account_level,
nex_password
).execute(database).await.unwrap();
//generate_s3_images(pid, &data).await;