Add login form and empty handler

[?]
Feb 17, 2021, 2:22 PM
OJO4B4QO2JQLMZTGTJJIXEUNDIN45RFLEJBUZBYA7IS34XDPUAVAC

Dependencies

  • [2] BCXEUKX6 Add config, static files and web server
  • [3] 4MZ4VIR7 Initial commit

Change contents

  • replacement in src/main.rs at line 2
    [2.24][2.24:70]()
    use actix_web::{middleware, App, HttpServer};
    [2.24]
    [2.70]
    use actix_web::{middleware, web, App, HttpServer};
  • edit in src/main.rs at line 8
    [2.111]
    [2.111]
    mod login;
    use crate::login::login_post;
  • replacement in src/main.rs at line 13
    [2.171][2.171:224]()
    std::env::set_var("RUST_LOG", "actix_web=info");
    [2.171]
    [2.224]
    std::env::set_var("RUST_LOG", "actix_web=debug");
  • edit in src/main.rs at line 37
    [2.912]
    [2.912]
    .service(web::resource("/login.do").route(web::post().to(login_post)))
  • file addition: login.rs (-xw-x--x--)
    [3.6]
    use serde_derive::{Deserialize, Serialize};
    use actix_web::http::header;
    use actix_web::{web, HttpResponse};
    #[derive(Serialize, Deserialize)]
    pub struct LoginParams {
    login: String,
    password: String,
    }
    pub async fn login_post(_params: web::Form<LoginParams>) -> HttpResponse {
    HttpResponse::Found()
    .append_header((header::LOCATION, "index.html"))
    .finish()
    }
  • file addition: style.css (-xw-x--x--)
    [2.1901]
    .content {
    width: 40em;
    margin: 0 auto;
    font-family: Tahoma, Verdana, Arial, sans-serif;
    }
    .navi {
    width: 100%;
    top: 0;
    left: 0;
    background-color: #444;
    overflow: hidden;
    text-align: right;
    }
    .navi form {
    display: inline;
    margin-right: 0;
    }
    .navi input {
    display: inline;
    }
    .navi fieldset {
    display: inline;
    border: none;
    }
  • edit in public/index.html at line 5
    [2.5792]
    [2.5792]
    <link rel="stylesheet" type="text/css" href="style.css" />
  • edit in public/index.html at line 7
    [2.5855][2.5855:5991]()
    <style>
    body {
    width: 40em;
    margin: 0 auto;
    font-family: Tahoma, Verdana, Arial, sans-serif;
    }
    </style>
  • edit in public/index.html at line 9
    [2.6006]
    [2.6006]
    <div class="navi">
    <form id="login-form" action="login.do" method="post">
    <fieldset>
    <input name="login" type="text" placeholder="Username, JID or e-mail" required autofocus />
    <input name="password" type="password" placeholder="Leave password empty to use OTP" autofocus />
    <input name="submit" type="submit" value="Login">
    </fieldset>
    </form>
    </div>
    <div class="content">
  • replacement in public/index.html at line 39
    [2.7525][2.7525:7603]()
    <li>User authentication with OTP via XMPP (no registration yet).</ul></p>
    [2.7525]
    [2.7603]
    <li>User authentication with OTP via XMPP or E-mail (no registration yet).</ul></p>
  • edit in public/index.html at line 59
    [2.8342]
    [2.8342]
    </div>
  • edit in Cargo.toml at line 15
    [2.8498]
    [2.8498]
    handlebars = "3.5"
  • replacement in Cargo.lock at line 79
    [2.10011][2.10011:10021]()
    "sha-1",
    [2.10011]
    [2.10021]
    "sha-1 0.9.4",
  • edit in Cargo.lock at line 328
    [2.15532]
    [2.15532]
    version = "0.7.3"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
    dependencies = [
    "block-padding",
    "byte-tools",
    "byteorder",
    "generic-array 0.12.3",
    ]
    [[package]]
    name = "block-buffer"
  • replacement in Cargo.lock at line 344
    [2.15710][2.15710:15728]()
    "generic-array",
    [2.15710]
    [2.15728]
    "generic-array 0.14.4",
    ]
    [[package]]
    name = "block-padding"
    version = "0.1.5"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5"
    dependencies = [
    "byte-tools",
  • edit in Cargo.lock at line 381
    [2.16384]
    [2.16384]
    [[package]]
    name = "byte-tools"
    version = "0.3.1"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
    [[package]]
    name = "byteorder"
    version = "1.4.2"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b"
  • edit in Cargo.lock at line 477
    [2.18586]
    [2.18586]
    ]
    [[package]]
    name = "digest"
    version = "0.8.1"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
    dependencies = [
    "generic-array 0.12.3",
  • replacement in Cargo.lock at line 494
    [2.18795][2.18795:18813]()
    "generic-array",
    [2.18795]
    [2.18813]
    "generic-array 0.14.4",
  • edit in Cargo.lock at line 532
    [2.19703]
    [2.19703]
    name = "fake-simd"
    version = "0.1.2"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
    [[package]]
  • edit in Cargo.lock at line 573
    [2.20518]
    [2.20518]
    "handlebars",
  • edit in Cargo.lock at line 621
    [2.21721]
    [2.21721]
    version = "0.12.3"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec"
    dependencies = [
    "typenum",
    ]
    [[package]]
    name = "generic-array"
  • edit in Cargo.lock at line 667
    [2.22533]
    [2.22533]
    ]
    [[package]]
    name = "handlebars"
    version = "3.5.2"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "964d0e99a61fe9b1b347389b77ebf8b7e1587b70293676aaca7d27e59b9073b2"
    dependencies = [
    "log",
    "pest",
    "pest_derive",
    "quick-error",
    "serde",
    "serde_json",
  • edit in Cargo.lock at line 794
    [2.25516]
    [2.25516]
    name = "maplit"
    version = "1.0.2"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
    [[package]]
  • edit in Cargo.lock at line 887
    [2.27709]
    [2.27709]
    version = "0.2.3"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
    [[package]]
    name = "opaque-debug"
  • edit in Cargo.lock at line 929
    [2.28637]
    [2.28637]
    name = "pest"
    version = "2.1.3"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53"
    dependencies = [
    "ucd-trie",
    ]
    [[package]]
    name = "pest_derive"
    version = "2.1.0"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0"
    dependencies = [
    "pest",
    "pest_generator",
    ]
    [[package]]
    name = "pest_generator"
    version = "2.1.3"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55"
    dependencies = [
    "pest",
    "pest_meta",
    "proc-macro2",
    "quote",
    "syn",
    ]
    [[package]]
    name = "pest_meta"
    version = "2.1.3"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d"
    dependencies = [
    "maplit",
    "pest",
    "sha-1 0.8.2",
    ]
    [[package]]
  • edit in Cargo.lock at line 1023
    [2.30139]
    [2.30139]
    [[package]]
    name = "quick-error"
    version = "2.0.0"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "3ac73b1112776fc109b2e61909bc46c7e1bf0d7f690ffb1676553acce16d5cda"
  • edit in Cargo.lock at line 1183
    [2.34025]
    [2.34025]
    ]
    [[package]]
    name = "sha-1"
    version = "0.8.2"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df"
    dependencies = [
    "block-buffer 0.7.3",
    "digest 0.8.1",
    "fake-simd",
    "opaque-debug 0.2.3",
  • replacement in Cargo.lock at line 1203
    [2.34233][2.34233:34250]()
    "block-buffer",
    [2.34233]
    [2.34250]
    "block-buffer 0.9.0",
  • replacement in Cargo.lock at line 1206
    [2.34276][2.34276:34304]()
    "digest",
    "opaque-debug",
    [2.34276]
    [2.34304]
    "digest 0.9.0",
    "opaque-debug 0.3.0",
  • edit in Cargo.lock at line 1479
    [2.40897]
    [2.40897]
    [[package]]
    name = "ucd-trie"
    version = "0.1.3"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"