Sign up method.
beginning of adding methods to create account and authentication.
This commit is contained in:
parent
855eb16973
commit
5e4e086247
5 changed files with 258 additions and 32 deletions
|
|
@ -4,13 +4,15 @@ use std::sync::Mutex;
|
|||
use actix_files as fs;
|
||||
use actix_web::{get, web, Responder, middleware, App, HttpServer, HttpRequest};
|
||||
use askama_actix::Template;
|
||||
use chrono::prelude::*;
|
||||
use clap::Parser;
|
||||
use ron::de::from_reader;
|
||||
use serde::Deserialize;
|
||||
|
||||
mod consts;
|
||||
mod model;
|
||||
mod db;
|
||||
mod hash;
|
||||
mod model;
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "home.html")]
|
||||
|
|
@ -98,16 +100,26 @@ async fn main() -> std::io::Result<()> {
|
|||
#[derive(Parser, Debug)]
|
||||
struct Args {
|
||||
#[arg(long)]
|
||||
test: bool
|
||||
dbtest: bool
|
||||
}
|
||||
|
||||
fn process_args() -> bool {
|
||||
let args = Args::parse();
|
||||
|
||||
if args.test {
|
||||
if let Err(error) = db::Connection::new() {
|
||||
println!("Error: {:?}", error)
|
||||
if args.dbtest {
|
||||
match db::Connection::new() {
|
||||
Ok(con) => {
|
||||
if let Err(error) = con.execute_file("sql/data_test.sql") {
|
||||
println!("Error: {:?}", error);
|
||||
}
|
||||
// Set the creation datetime to 'now'.
|
||||
con.execute_sql("UPDATE [User] SET [creation_datetime] = ?1 WHERE [email] = 'paul@test.org'", [Utc::now()]).unwrap();
|
||||
},
|
||||
Err(error) => {
|
||||
println!("Error: {:?}", error)
|
||||
},
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue