Compare commits

...

4 commits

Author SHA1 Message Date
793a8dcb7a
update todo 2023-08-31 01:17:32 -07:00
45a2cca6f6
rename gjp2 to gjp 2023-08-31 01:09:52 -07:00
fc9c120076
remove fix outside my control 2023-08-31 00:34:09 -07:00
609c00fca1
add return clause + update todo 2023-08-30 16:57:11 -07:00
6 changed files with 8 additions and 7 deletions

View file

@ -34,6 +34,5 @@ _these features are implemented_
## todo ## todo
- find out why the last user's colors in getusers are broken???? (might be rubrub issue !!) - fix gd not parsing the response from get_users correctly (sometimes has a hashtag in it? sometimes not? idfk)
- move authorization logic to (./src/helpers/accounts.rs)[./src/helpers/accounts.rs] - move authorization logic to (./src/helpers/accounts.rs)[./src/helpers/accounts.rs]
- make gjp2 authentication faster (bcrypt?)

View file

@ -30,5 +30,6 @@ impl Config {
pub static CONFIG: LazyLock<Config> = LazyLock::new(|| { pub static CONFIG: LazyLock<Config> = LazyLock::new(|| {
let config = Config::load_from_file("config.toml"); let config = Config::load_from_file("config.toml");
config
return config;
}); });

View file

@ -30,6 +30,7 @@ pub fn login_account(input: Form<FromLoginAccount>) -> status::Custom<&'static s
return status::Custom(Status::Ok, "-9") return status::Custom(Status::Ok, "-9")
} }
// account verification
{ {
use crate::schema::accounts::dsl::*; use crate::schema::accounts::dsl::*;
@ -42,7 +43,7 @@ pub fn login_account(input: Form<FromLoginAccount>) -> status::Custom<&'static s
Ok(account_id_gjp2) => { Ok(account_id_gjp2) => {
let user_id = helpers::accounts::get_user_id_from_account_id(account_id_gjp2.0); let user_id = helpers::accounts::get_user_id_from_account_id(account_id_gjp2.0);
match verify_password(helpers::gjp2::get_gjp2(input.password.clone()).as_bytes(), account_id_gjp2.1.as_str()) { match verify_password(helpers::gjp::get_gjp2(input.password.clone()).as_bytes(), account_id_gjp2.1.as_str()) {
Ok(_) => return status::Custom(Status::Ok, Ok(_) => return status::Custom(Status::Ok,
Box::leak(format!("{},{}", account_id_gjp2.0, user_id).into_boxed_str()) Box::leak(format!("{},{}", account_id_gjp2.0, user_id).into_boxed_str())
), ),

View file

@ -60,7 +60,7 @@ pub fn register_account(input: Form<FormRegisterAccount>) -> status::Custom<&'st
let new_account = NewAccount { let new_account = NewAccount {
username: input.userName.clone(), username: input.userName.clone(),
gjp2: helpers::gjp2::get_gjp2_hashed(input.password.clone()), gjp2: helpers::gjp::get_gjp2_hashed(input.password.clone()),
email: input.email.clone() email: input.email.clone()
}; };
inserted_account = diesel::insert_into(accounts) inserted_account = diesel::insert_into(accounts)

View file

@ -1,4 +1,4 @@
pub mod accounts; pub mod accounts;
pub mod clean; pub mod clean;
pub mod format; pub mod format;
pub mod gjp2; pub mod gjp;