mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2024-11-23 01:45:50 +03:00
update username
This commit is contained in:
parent
595e79a014
commit
6ef941f73d
13 changed files with 238 additions and 171 deletions
215
Cargo.lock
generated
215
Cargo.lock
generated
|
@ -59,9 +59,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "actix-http"
|
||||
version = "3.0.0-beta.8"
|
||||
version = "3.0.0-beta.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3cd16d6b846983ffabfd081e1a67abd7698094fcbe7b3d9bcf1acbc6f546a516"
|
||||
checksum = "01260589f1aafad11224002741eb37bc603b4ce55b4e3556d2b2122f9aac7c51"
|
||||
dependencies = [
|
||||
"actix-codec",
|
||||
"actix-rt",
|
||||
|
@ -93,7 +93,7 @@ dependencies = [
|
|||
"pin-project-lite",
|
||||
"rand 0.8.4",
|
||||
"regex",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
"sha-1",
|
||||
"smallvec",
|
||||
"time 0.2.27",
|
||||
|
@ -110,7 +110,7 @@ dependencies = [
|
|||
"actix-service",
|
||||
"actix-web",
|
||||
"futures-util",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
"serde_json",
|
||||
"time 0.2.27",
|
||||
]
|
||||
|
@ -135,7 +135,7 @@ dependencies = [
|
|||
"http",
|
||||
"log",
|
||||
"regex",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -236,7 +236,7 @@ dependencies = [
|
|||
"paste",
|
||||
"pin-project",
|
||||
"regex",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"smallvec",
|
||||
|
@ -402,9 +402,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
|
|||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.50"
|
||||
version = "0.1.51"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b98e84bbb4cbcdd97da190ba0c58a1bb0de2c1fdf67d159e192ed766aeca722"
|
||||
checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -459,7 +459,7 @@ dependencies = [
|
|||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"rand 0.8.4",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
]
|
||||
|
@ -482,14 +482,14 @@ version = "1.3.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
|
||||
dependencies = [
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.2.1"
|
||||
version = "1.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||
checksum = "2da1976d75adbe5fbc88130ecd119529cf1cc6a93ae1546d8696ee66f0d21af1"
|
||||
|
||||
[[package]]
|
||||
name = "bitvec"
|
||||
|
@ -585,7 +585,7 @@ dependencies = [
|
|||
"derive_builder",
|
||||
"mime",
|
||||
"mime_guess",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"walkdir",
|
||||
|
@ -643,7 +643,7 @@ dependencies = [
|
|||
"lazy_static",
|
||||
"nom 5.1.2",
|
||||
"rust-ini",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
"serde-hjson",
|
||||
"serde_json",
|
||||
"toml",
|
||||
|
@ -938,7 +938,7 @@ version = "1.6.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
|
||||
dependencies = [
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -974,9 +974,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "filetime"
|
||||
version = "0.2.14"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8"
|
||||
checksum = "975ccf83d8d9d0d84682850a38c8169027be83368805971cc4f238c2b245bc98"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
|
@ -1045,9 +1045,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.15"
|
||||
version = "0.3.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e7e43a803dae2fa37c1f6a8fe121e1f7bf9548b4dfc0522a42f34145dadfc27"
|
||||
checksum = "1adc00f486adfc9ce99f77d717836f0c5aa84965eb0b4f051f4e83f7cab53f8b"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
|
@ -1060,9 +1060,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.15"
|
||||
version = "0.3.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e682a68b29a882df0545c143dc3646daefe80ba479bcdede94d5a703de2871e2"
|
||||
checksum = "74ed2411805f6e4e3d9bc904c95d5d423b89b3b25dc0250aa74729de20629ff9"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
|
@ -1070,15 +1070,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.15"
|
||||
version = "0.3.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0402f765d8a89a26043b889b26ce3c4679d268fa6bb22cd7c6aad98340e179d1"
|
||||
checksum = "af51b1b4a7fdff033703db39de8802c673eb91855f2e0d47dcf3bf2c0ef01f99"
|
||||
|
||||
[[package]]
|
||||
name = "futures-executor"
|
||||
version = "0.3.15"
|
||||
version = "0.3.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "badaa6a909fac9e7236d0620a2f57f7664640c56575b71a7552fbd68deafab79"
|
||||
checksum = "4d0d535a57b87e1ae31437b892713aee90cd2d7b0ee48727cd11fc72ef54761c"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
|
@ -1087,15 +1087,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.15"
|
||||
version = "0.3.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "acc499defb3b348f8d8f3f66415835a9131856ff7714bf10dadfc4ec4bdb29a1"
|
||||
checksum = "0b0e06c393068f3a6ef246c75cdca793d6a46347e75286933e5e75fd2fd11582"
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.15"
|
||||
version = "0.3.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4c40298486cdf52cc00cd6d6987892ba502c7656a16a4192a9992b1ccedd121"
|
||||
checksum = "c54913bae956fb8df7f4dc6fc90362aa72e69148e3f39041fbe8742d21e0ac57"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"proc-macro-hack",
|
||||
|
@ -1106,21 +1106,21 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.15"
|
||||
version = "0.3.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a57bead0ceff0d6dde8f465ecd96c9338121bb7717d3e7b108059531870c4282"
|
||||
checksum = "c0f30aaa67363d119812743aa5f33c201a7a66329f97d1a887022971feea4b53"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.15"
|
||||
version = "0.3.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a16bef9fc1a4dddb5bee51c989e3fbba26569cbb0e31f5b303c184e3dd33dae"
|
||||
checksum = "bbe54a98670017f3be909561f6ad13e810d9a51f3f061b902062ca3da80799f2"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.15"
|
||||
version = "0.3.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "feb5c238d27e2bf94ffdfd27b2c29e3df4a68c4193bb6427384259e2bf191967"
|
||||
checksum = "67eb846bfd58e44a8481a00049e82c43e0ccb5d61f8dc071057cb19249dd4d78"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"futures-channel",
|
||||
|
@ -1382,18 +1382,18 @@ checksum = "9028f49264629065d057f340a86acb84867925865f73bbf8d47b4d149a7e88b8"
|
|||
|
||||
[[package]]
|
||||
name = "jobserver"
|
||||
version = "0.1.22"
|
||||
version = "0.1.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "972f5ae5d1cb9c6ae417789196c803205313edde988685da5e3aae0827b9e7fd"
|
||||
checksum = "f5ca711fd837261e14ec9e674f092cbb931d3fa1482b017ae59328ddc6f3212b"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.51"
|
||||
version = "0.3.52"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "83bdfbace3a0e81a4253f73b49e960b053e396a11012cbd49b9b74d6a2b67062"
|
||||
checksum = "ce791b7ca6638aae45be056e068fc756d871eb3b3b10b8efa62d1c9cec616752"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
@ -1450,14 +1450,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.98"
|
||||
version = "0.2.99"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790"
|
||||
checksum = "a7f823d141fe0a24df1e23b4af4e3c7ba9e5966ec514ea068c93024aa7deb765"
|
||||
|
||||
[[package]]
|
||||
name = "libmcaptcha"
|
||||
version = "0.1.4"
|
||||
source = "git+https://github.com/mCaptcha/libmcaptcha?branch=master#1d4f97f511ad851a58359ecd1737b381b61cf22e"
|
||||
source = "git+https://github.com/mCaptcha/libmcaptcha?branch=master#ec5a38093cbfb37323cf706b9f26ce0c3f6e57c7"
|
||||
dependencies = [
|
||||
"actix",
|
||||
"derive_builder",
|
||||
|
@ -1467,7 +1467,7 @@ dependencies = [
|
|||
"pretty_env_logger",
|
||||
"rand 0.8.4",
|
||||
"redis",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
]
|
||||
|
@ -1595,7 +1595,7 @@ dependencies = [
|
|||
"rand 0.8.4",
|
||||
"rust-embed",
|
||||
"sailfish",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
"serde_json",
|
||||
"serde_yaml",
|
||||
"sqlx",
|
||||
|
@ -1610,7 +1610,7 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"console_error_panic_hook",
|
||||
"pow_sha256",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"wasm-bindgen",
|
||||
|
@ -1691,9 +1691,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "native-tls"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4"
|
||||
checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"libc",
|
||||
|
@ -1769,7 +1769,7 @@ dependencies = [
|
|||
"autocfg",
|
||||
"num-integer",
|
||||
"num-traits 0.2.14",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1779,7 +1779,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "26873667bbbb7c5182d4a37c1add32cdf09f841af72da53318fdb81543c15085"
|
||||
dependencies = [
|
||||
"num-traits 0.2.14",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1812,7 +1812,7 @@ dependencies = [
|
|||
"autocfg",
|
||||
"num-integer",
|
||||
"num-traits 0.2.14",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2039,7 +2039,7 @@ dependencies = [
|
|||
"bincode",
|
||||
"derive_builder",
|
||||
"num",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
"sha2",
|
||||
]
|
||||
|
||||
|
@ -2241,9 +2241,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "redis"
|
||||
version = "0.20.2"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4f0ceb2ec0dd769483ecd283f6615aa83dcd0be556d5294c6e659caefe7cc54"
|
||||
checksum = "3bbc1838d8d0b423f325d6fac80c5f19109c7d16c8c37c584893dc17cf71c63d"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
|
@ -2263,9 +2263,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.9"
|
||||
version = "0.2.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee"
|
||||
checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
@ -2335,9 +2335,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rust-embed"
|
||||
version = "5.9.0"
|
||||
version = "6.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fe1fe6aac5d6bb9e1ffd81002340363272a7648234ec7bdfac5ee202cb65523"
|
||||
checksum = "3203eb498314cbc2c6671278c8da3c64a16476d79ad1442bc13e8629706f24f7"
|
||||
dependencies = [
|
||||
"rust-embed-impl",
|
||||
"rust-embed-utils",
|
||||
|
@ -2346,9 +2346,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rust-embed-impl"
|
||||
version = "5.9.0"
|
||||
version = "6.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ed91c41c42ef7bf687384439c312e75e0da9c149b0390889b94de3c7d9d9e66"
|
||||
checksum = "a1c03c7b7b780fdafde5055576641fd6b4d38095e3399cd0588552639aeff432"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -2359,10 +2359,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rust-embed-utils"
|
||||
version = "5.1.0"
|
||||
version = "6.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a512219132473ab0a77b52077059f1c47ce4af7fbdc94503e9862a34422876d"
|
||||
checksum = "5b5f2909061b856ce587f2496fc149a71d576cb2e0842c79f0dc82741622c6d0"
|
||||
dependencies = [
|
||||
"sha2",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
|
@ -2560,9 +2561,9 @@ checksum = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8"
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.126"
|
||||
version = "1.0.127"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03"
|
||||
checksum = "f03b9878abf6d14e6779d3f24f07b2cfa90352cfec4acc5aab8f1ac7f146fae8"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
@ -2581,9 +2582,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.126"
|
||||
version = "1.0.127"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43"
|
||||
checksum = "a024926d3432516606328597e0f224a51355a493b49fdd67e9209187cbe55ecc"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -2592,14 +2593,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.64"
|
||||
version = "1.0.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
|
||||
checksum = "336b10da19a12ad094b59d870ebde26a45402e5b470add4b5fd03c5048a32127"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2611,7 +2612,7 @@ dependencies = [
|
|||
"form_urlencoded",
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2622,7 +2623,7 @@ checksum = "15654ed4ab61726bf918a39cb8d98a2e2995b002387807fa6ba58fdf7f59bb23"
|
|||
dependencies = [
|
||||
"dtoa",
|
||||
"linked-hash-map",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
"yaml-rust",
|
||||
]
|
||||
|
||||
|
@ -2669,15 +2670,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "siphasher"
|
||||
version = "0.3.5"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cbce6d4507c7e4a3962091436e56e95290cb71fa302d0d270e32130b75fbff27"
|
||||
checksum = "729a25c17d72b06c68cb47955d44fda88ad2d3e7d77e025663fdd69b93dd71a1"
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.3"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527"
|
||||
checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
|
@ -2687,9 +2688,9 @@ checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
|
|||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e3dfc207c526015c632472a77be09cf1b6e46866581aecae5cc38fb4235dea2"
|
||||
checksum = "765f090f0e423d2b55843402a07915add955e7d60657db13707a159727326cad"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
|
@ -2758,7 +2759,7 @@ dependencies = [
|
|||
"percent-encoding",
|
||||
"rand 0.8.4",
|
||||
"rustls",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
"serde_json",
|
||||
"sha-1",
|
||||
"sha2",
|
||||
|
@ -2789,7 +2790,7 @@ dependencies = [
|
|||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"sqlx-core",
|
||||
|
@ -2847,7 +2848,7 @@ checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
"serde_derive",
|
||||
"syn",
|
||||
]
|
||||
|
@ -2861,7 +2862,7 @@ dependencies = [
|
|||
"base-x",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"sha1",
|
||||
|
@ -2884,7 +2885,7 @@ dependencies = [
|
|||
"new_debug_unreachable",
|
||||
"phf_shared",
|
||||
"precomputed-hash",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2923,9 +2924,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.73"
|
||||
version = "1.0.74"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7"
|
||||
checksum = "1873d832550d4588c3dbc20f01361ab00bfe741048f71e3fecf145a7cc18b29c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -3042,9 +3043,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "1.3.0"
|
||||
version = "1.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ac2e1d4bd0f75279cfd5a076e0d578bbf02c22b7c39e766c437dd49b3ec43e0"
|
||||
checksum = "848a1e1181b9f6753b5e96a092749e29b11d19ede67dfbbd6c7dc7e0f49b5338"
|
||||
dependencies = [
|
||||
"tinyvec_macros",
|
||||
]
|
||||
|
@ -3057,9 +3058,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
|||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.8.2"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2602b8af3767c285202012822834005f596c811042315fa7e9f5b12b2a43207"
|
||||
checksum = "4b7b349f11a7047e6d1276853e612d152f5e8a352c61917887cc2169e2366b4c"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"bytes",
|
||||
|
@ -3126,7 +3127,7 @@ version = "0.5.8"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
|
||||
dependencies = [
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3249,7 +3250,7 @@ dependencies = [
|
|||
"idna",
|
||||
"lazy_static",
|
||||
"regex",
|
||||
"serde 1.0.126",
|
||||
"serde 1.0.127",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"url",
|
||||
|
@ -3320,9 +3321,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.74"
|
||||
version = "0.2.75"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd"
|
||||
checksum = "b608ecc8f4198fe8680e2ed18eccab5f0cd4caaf3d83516fa5fb2e927fda2586"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"wasm-bindgen-macro",
|
||||
|
@ -3330,9 +3331,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.74"
|
||||
version = "0.2.75"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900"
|
||||
checksum = "580aa3a91a63d23aac5b6b267e2d13cb4f363e31dce6c352fca4752ae12e479f"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"lazy_static",
|
||||
|
@ -3345,9 +3346,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.24"
|
||||
version = "0.4.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5fba7978c679d53ce2d0ac80c8c175840feb849a161664365d1287b41f2e67f1"
|
||||
checksum = "16646b21c3add8e13fdb8f20172f8a28c3dbf62f45406bcff0233188226cfe0c"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"js-sys",
|
||||
|
@ -3357,9 +3358,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.74"
|
||||
version = "0.2.75"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4"
|
||||
checksum = "171ebf0ed9e1458810dfcb31f2e766ad6b3a89dbda42d8901f2b268277e5f09c"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
|
@ -3367,9 +3368,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.74"
|
||||
version = "0.2.75"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97"
|
||||
checksum = "6c2657dd393f03aa2a659c25c6ae18a13a4048cebd220e147933ea837efc589f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -3380,15 +3381,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.74"
|
||||
version = "0.2.75"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f"
|
||||
checksum = "2e0c4a743a309662d45f4ede961d7afa4ba4131a59a639f29b0069c3798bbcc2"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-test"
|
||||
version = "0.3.24"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8cab416a9b970464c2882ed92d55b0c33046b08e0bdc9d59b3b718acd4e1bae8"
|
||||
checksum = "ce783b6c3854292723f498b7bfcf65a782a320b6f1cb3012d08dfbc603fa62f5"
|
||||
dependencies = [
|
||||
"console_error_panic_hook",
|
||||
"js-sys",
|
||||
|
@ -3400,9 +3401,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-test-macro"
|
||||
version = "0.3.24"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd4543fc6cf3541ef0d98bf720104cc6bd856d7eba449fd2aa365ef4fed0e782"
|
||||
checksum = "3859815cf8435b92f3a34381bef950daffc1403bbb77ef99e35422a7b0abb194"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -3410,9 +3411,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.51"
|
||||
version = "0.3.52"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e828417b379f3df7111d3a2a9e5753706cae29c41f7c4029ee9fd77f3e09e582"
|
||||
checksum = "01c70a82d842c9979078c772d4a1344685045f1a5628f677c2b2eab4dd7d2696"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
|
|
|
@ -28,22 +28,17 @@ members = [
|
|||
]
|
||||
|
||||
[dependencies]
|
||||
#actix-web = "3.3.2"
|
||||
actix-web = "4.0.0-beta.8"
|
||||
actix = "0.12"
|
||||
#actix-identity = "0.3"
|
||||
actix-identity = "0.4.0-beta.2"
|
||||
actix-http = "3.0.0-beta.8"
|
||||
#actix-http = "2.2"
|
||||
actix-rt = "2"
|
||||
#actix-cors= "0.5.4"
|
||||
actix-cors = "0.6.0-beta.2"
|
||||
#actix-service = "0.0.6"
|
||||
actix-service = "2.0.0"
|
||||
my-codegen = {package = "actix-web-codegen", git ="https://github.com/realaravinth/actix-web"}
|
||||
|
||||
mime_guess = "2.0.3"
|
||||
rust-embed = "5.9.0"
|
||||
rust-embed = "6.0.0"
|
||||
cache-buster = { git = "https://github.com/realaravinth/cache-buster" }
|
||||
|
||||
futures = "0.3.15"
|
||||
|
|
|
@ -54,7 +54,7 @@ struct Asset;
|
|||
pub fn handle_embedded_file(path: &str) -> HttpResponse {
|
||||
match Asset::get(path) {
|
||||
Some(content) => {
|
||||
let body: Body = match content {
|
||||
let body: Body = match content.data {
|
||||
Cow::Borrowed(bytes) => bytes.into(),
|
||||
Cow::Owned(bytes) => bytes.into(),
|
||||
};
|
||||
|
|
|
@ -56,24 +56,36 @@ const PAGE: &str = "Settings";
|
|||
|
||||
#[derive(TemplateOnce, Clone)]
|
||||
#[template(path = "panel/settings/index.html")]
|
||||
pub struct IndexPage {
|
||||
pub struct IndexPage<'a> {
|
||||
email: Option<String>,
|
||||
secret: String,
|
||||
username: &'a str,
|
||||
}
|
||||
|
||||
#[my_codegen::get(path = "crate::PAGES.panel.settings.home", wrap = "crate::CheckLogin")]
|
||||
async fn settings(data: AppData, id: Identity) -> PageResult<impl Responder> {
|
||||
let username = id.identity().unwrap();
|
||||
|
||||
struct DBResult {
|
||||
email: Option<String>,
|
||||
secret: String,
|
||||
}
|
||||
|
||||
let details = sqlx::query_as!(
|
||||
IndexPage,
|
||||
DBResult,
|
||||
r#"SELECT email, secret FROM mcaptcha_users WHERE name = ($1)"#,
|
||||
&username,
|
||||
)
|
||||
.fetch_one(&data.db)
|
||||
.await?;
|
||||
|
||||
let body = details.render_once().unwrap();
|
||||
let data = IndexPage {
|
||||
email: details.email,
|
||||
secret: details.secret,
|
||||
username: &username,
|
||||
};
|
||||
|
||||
let body = data.render_once().unwrap();
|
||||
Ok(HttpResponse::Ok()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body(body))
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
use cache_buster::Files;
|
||||
|
||||
pub struct FileMap {
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
pub mod filemap;
|
||||
pub mod static_files;
|
||||
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
use std::borrow::Cow;
|
||||
|
||||
use actix_web::body::Body;
|
||||
|
@ -82,7 +82,7 @@ struct Asset;
|
|||
fn handle_assets(path: &str) -> HttpResponse {
|
||||
match Asset::get(path) {
|
||||
Some(content) => {
|
||||
let body: Body = match content {
|
||||
let body: Body = match content.data {
|
||||
Cow::Borrowed(bytes) => bytes.into(),
|
||||
Cow::Owned(bytes) => bytes.into(),
|
||||
};
|
||||
|
@ -112,7 +112,7 @@ struct Favicons;
|
|||
fn handle_favicons(path: &str) -> HttpResponse {
|
||||
match Favicons::get(path) {
|
||||
Some(content) => {
|
||||
let body: Body = match content {
|
||||
let body: Body = match content.data {
|
||||
Cow::Borrowed(bytes) => bytes.into(),
|
||||
Cow::Owned(bytes) => bytes.into(),
|
||||
};
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
id="form"
|
||||
>
|
||||
<h1 class="form__title">
|
||||
Signin to mCaptcha
|
||||
Sign into mCaptcha
|
||||
</h1>
|
||||
<label class="sitekey-form__label" for="login">
|
||||
Username or email address
|
||||
|
|
|
@ -83,6 +83,10 @@ const registerUser = async (e: Event) => {
|
|||
export const index = () => {
|
||||
const form = <HTMLFontElement>document.getElementById('form');
|
||||
form.addEventListener('submit', registerUser, true);
|
||||
usernameElement.addEventListener('input', userExists, false);
|
||||
usernameElement.addEventListener(
|
||||
'input',
|
||||
async () => await userExists(),
|
||||
false,
|
||||
);
|
||||
registerShowPassword();
|
||||
};
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import fetchMock from 'jest-fetch-mock';
|
||||
|
||||
import userExists from './userExists';
|
||||
|
@ -39,6 +38,10 @@ it('finds exchange', async () => {
|
|||
usernameField.value = 'test';
|
||||
expect(await userExists()).toBe(true);
|
||||
|
||||
usernameField.value = 'test';
|
||||
fetchMock.mockResponseOnce(JSON.stringify({exists: true}));
|
||||
expect(await userExists(usernameField)).toBe(true);
|
||||
|
||||
fetchMock.mockResponseOnce(JSON.stringify({exists: false}));
|
||||
expect(await userExists()).toBe(false);
|
||||
});
|
||||
|
|
|
@ -20,8 +20,14 @@ import ROUTES from '../../../api/v1/routes';
|
|||
import genJsonPayload from '../../../utils/genJsonPayload';
|
||||
import createError from '../../../components/error/index';
|
||||
|
||||
const userExists = async () => {
|
||||
const username = <HTMLInputElement>document.getElementById('username');
|
||||
const userExists = async (element?: HTMLInputElement) => {
|
||||
console.log(element);
|
||||
let username;
|
||||
if (element === undefined) {
|
||||
username = <HTMLInputElement>document.getElementById('username');
|
||||
} else {
|
||||
username = element;
|
||||
}
|
||||
const val = username.value;
|
||||
const payload = {
|
||||
val,
|
||||
|
|
|
@ -17,6 +17,22 @@
|
|||
<h1 class="form__title">
|
||||
<.= PAGE .>
|
||||
</h1>
|
||||
<form class="settings__form" id="settings__username-form"
|
||||
action="<.= crate::V1_API_ROUTES.account.update_username .>"
|
||||
method="post">
|
||||
<label class="settings-form__label" for="username">
|
||||
Username
|
||||
<input
|
||||
class="settings-form__input"
|
||||
type="text"
|
||||
name="username"
|
||||
id="username"
|
||||
value="<.= username .>"
|
||||
/>
|
||||
</label>
|
||||
<button class="settings__submit-btn" type="submit">Update</button>
|
||||
</form>
|
||||
|
||||
<form class="settings__form" id="settings__email-form"
|
||||
action="<.= crate::V1_API_ROUTES.account.update_email .>"
|
||||
method="post">
|
||||
|
|
|
@ -20,6 +20,7 @@ import CopyIcon from '../../components/clipboard/';
|
|||
import createError from '../../components/error/';
|
||||
|
||||
import emailExists from '../../auth/register/ts/emailExists';
|
||||
import userExists from '../../auth/register/ts/userExists';
|
||||
|
||||
import LazyElement from '../../utils/lazyElement';
|
||||
import isBlankString from '../../utils/isBlankString';
|
||||
|
@ -34,18 +35,22 @@ const SECRET_COPY_DONE_ICON = 'settings__secret-copy-done';
|
|||
// form IDs
|
||||
const DELETE_FORM = 'settings__delete-form';
|
||||
const EMAIL_FORM = 'settings__email-form';
|
||||
const USERNAME_FORM = 'settings__username-form';
|
||||
const SECRET_FORM = 'settings__secret-form';
|
||||
|
||||
// form elements
|
||||
const deleteForm = new LazyElement(DELETE_FORM);
|
||||
const emailForm = new LazyElement(EMAIL_FORM);
|
||||
const usernameForm = new LazyElement(USERNAME_FORM);
|
||||
const secretForm = new LazyElement(SECRET_FORM);
|
||||
|
||||
// field IDs
|
||||
const EMAIL = 'email';
|
||||
const USERNAME = 'username';
|
||||
|
||||
// field elements
|
||||
const emailField = new LazyElement(EMAIL);
|
||||
const usernameField = new LazyElement(USERNAME);
|
||||
|
||||
// form event handlers
|
||||
const updateEmail = async (e: Event) => {
|
||||
|
@ -71,6 +76,28 @@ const updateEmail = async (e: Event) => {
|
|||
}
|
||||
};
|
||||
|
||||
const updateUsername = async (e: Event) => {
|
||||
e.preventDefault();
|
||||
const usernameElement = <HTMLInputElement>usernameField.get();
|
||||
const username = usernameElement.value;
|
||||
isBlankString(username, 'username', e);
|
||||
if (await userExists(usernameElement)) {
|
||||
return;
|
||||
} else {
|
||||
const url = getFormUrl(<HTMLFormElement>usernameForm.get());
|
||||
const payload = {
|
||||
username,
|
||||
};
|
||||
const res = await fetch(url, genJsonPayload(payload));
|
||||
if (res.ok) {
|
||||
window.location.reload();
|
||||
} else {
|
||||
const err = await res.json();
|
||||
createError(err.error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const updateSecret = (e: Event) => {
|
||||
e.preventDefault();
|
||||
const msg =
|
||||
|
@ -93,6 +120,11 @@ const deleteAccount = (e: Event) => {
|
|||
const registerForms = () => {
|
||||
deleteForm.get().addEventListener('submit', e => deleteAccount(e), true);
|
||||
emailForm.get().addEventListener('submit', e => updateEmail(e), true);
|
||||
usernameForm.get().addEventListener('submit', e => updateUsername(e), true);
|
||||
console.log(usernameField.get());
|
||||
usernameField
|
||||
.get()
|
||||
.addEventListener('input', async () => await userExists(), false);
|
||||
secretForm.get().addEventListener('submit', e => updateSecret(e), true);
|
||||
};
|
||||
|
||||
|
@ -106,7 +138,6 @@ const initCopySecret = () => {
|
|||
};
|
||||
|
||||
/// TODO email update button should only change if email value has been changed
|
||||
|
||||
const index = () => {
|
||||
registerShowPassword();
|
||||
initCopySecret();
|
||||
|
|
Loading…
Reference in a new issue