mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-24 16:17:44 +00:00
Move generate_sid to login server
This commit is contained in:
parent
dbade00616
commit
039f4d7f95
2 changed files with 11 additions and 12 deletions
|
@ -5,10 +5,20 @@ use axum::extract::{Query, State};
|
|||
use axum::response::{Html, Redirect};
|
||||
use axum::routing::post;
|
||||
use axum::{Form, Router, routing::get};
|
||||
use kawari::generate_sid;
|
||||
use rand::Rng;
|
||||
use rand::distributions::Alphanumeric;
|
||||
use rusqlite::Connection;
|
||||
use serde::Deserialize;
|
||||
|
||||
fn generate_sid() -> String {
|
||||
let random_id: String = rand::thread_rng()
|
||||
.sample_iter(&Alphanumeric)
|
||||
.take(56)
|
||||
.map(char::from)
|
||||
.collect();
|
||||
random_id.to_lowercase()
|
||||
}
|
||||
|
||||
pub enum LoginError {
|
||||
WrongUsername,
|
||||
WrongPassword,
|
||||
|
|
11
src/lib.rs
11
src/lib.rs
|
@ -2,8 +2,6 @@
|
|||
|
||||
use common::CustomizeData;
|
||||
use minijinja::Environment;
|
||||
use rand::Rng;
|
||||
use rand::distributions::Alphanumeric;
|
||||
|
||||
/// The blowfish implementation used for packet encryption.
|
||||
pub mod blowfish;
|
||||
|
@ -77,15 +75,6 @@ pub const CHAR_NAME_MAX_LENGTH: usize = 32;
|
|||
|
||||
pub const CHAR_NAME: &str = "Test User";
|
||||
|
||||
pub fn generate_sid() -> String {
|
||||
let random_id: String = rand::thread_rng()
|
||||
.sample_iter(&Alphanumeric)
|
||||
.take(56)
|
||||
.map(char::from)
|
||||
.collect();
|
||||
random_id.to_lowercase()
|
||||
}
|
||||
|
||||
pub fn setup_default_environment() -> Environment<'static> {
|
||||
let mut env = Environment::new();
|
||||
env.add_template("admin.html", include_str!("../templates/admin.html"))
|
||||
|
|
Loading…
Add table
Reference in a new issue