auth_service_dhz 0.1.9

A simple authentication service example with login and database connection.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// #![allow(dead_code, unused_variables)]
use rand::{prelude::*, thread_rng};
pub use auth_utils::{login, models::Credentials};
use  database::Status;

pub fn authenticate(creds: &mut Credentials) {
    let timeout = thread_rng().gen_range(100..500);
    println!("Simulating authentication delay:{timeout}");
    if let Status::Connected = database::connect_to_database() {
        println!("Connected to the database");
        login(creds);
    } else {
        println!("Failed to connect to the database");
    }
}

mod database;
pub mod auth_utils;