diff --git a/frontend/.gitignore b/frontend/.gitignore index ba827864..aa356810 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -3,3 +3,4 @@ dist/ /target .html output/ +static diff --git a/frontend/package.json b/frontend/package.json index 2d06e2c6..cb26b1a1 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,6 +10,7 @@ "start": "find . | entr yarn build-dev", "build-dev": "cargo run && webpack --config webpack.dev.js", "build-fast-dev": "cargo run && webpack-dev-server --config webpack.dev.js", + "build-check": "webpack-dev-server --config webpack.dev.js", "build": "cargo run && webpack --config webpack.prod.js" }, "private": true, diff --git a/frontend/src/main.rs b/frontend/src/main.rs index 7b37af81..a4f9cff8 100644 --- a/frontend/src/main.rs +++ b/frontend/src/main.rs @@ -4,7 +4,7 @@ use tokio::fs; use tokio::io::{Error, ErrorKind}; #[derive(Clone, TemplateOnce)] -#[template(path = "index.html")] +#[template(path = "auth/login/index.html")] struct IndexPage { name: String, title: String, @@ -66,7 +66,7 @@ mod signup { use super::*; #[derive(TemplateOnce, Clone)] - #[template(path = "signup/index.html")] + #[template(path = "auth/register/index.html")] pub struct IndexPage { pub name: String, pub title: String, @@ -83,7 +83,7 @@ mod signup { impl IndexPage { pub async fn run(&self) -> Result<(), Error> { - let dir = root_path("signup"); + let dir = root_path("register"); let file = rel_path(&dir, "index.html"); print!(""); diff --git a/frontend/templates/_reset.scss b/frontend/templates/_reset.scss new file mode 100644 index 00000000..e209c163 --- /dev/null +++ b/frontend/templates/_reset.scss @@ -0,0 +1,4 @@ +* { + padding: 0; + margin: 0; +} diff --git a/frontend/templates/api/v1/routes.js b/frontend/templates/api/v1/routes.js new file mode 100644 index 00000000..d6bc8355 --- /dev/null +++ b/frontend/templates/api/v1/routes.js @@ -0,0 +1,47 @@ +const ROUTES = { + registerUser: '/api/v1/signup', + + loginUser: '/api/v1/signin', + + signoutUser: '/api/v1/signout', + + deleteAccount: '/api/v1/account/delete', + + usernameExists: '/api/v1/account/username/exists', + + emailExists: '/api/v1/account/email/exists', + + healthCheck: '/api/v1/meta/health', + + buildDetails: '/api/v1/meta/build', + + addDomain: '/api/v1/mcaptcha/domain/add', + + challengeDomain: '/api/v1/mcaptcha/domain/domain/verify/challenge/get', + + proveDomain: '/api/v1/mcaptcha/domain/domain/verify/challenge/prove', + + deleteDomain: '/api/v1/mcaptcha/domain/delete', + + addToken: '/api/v1/mcaptcha/domain/token/add', + + updateTokenKey: '/api/v1/mcaptcha/domain/token/update', + + getTokenKey: '/api/v1/mcaptcha/domain/token/get', + + deleteToken: '/api/v1/mcaptcha/domain/token/delete', + + addTokenLevels: '/api/v1/mcaptcha/domain/token/levels/add', + + updateTokenLevels: '/api/v1/mcaptcha/domain/token/levels/update', + + deleteTokenLevels: '/api/v1/mcaptcha/domain/token/levels/delete', + + getTokenLevels: '/api/v1/mcaptcha/domain/token/levels/get', + + getTokenDuration: '/api/v1/mcaptcha/domain/token/token/get', + + updateTokenDuration: '/api/v1/mcaptcha/domain/token/token/update', +}; + +export default ROUTES; diff --git a/frontend/templates/auth/forms.scss b/frontend/templates/auth/forms.scss new file mode 100644 index 00000000..61ef9d5d --- /dev/null +++ b/frontend/templates/auth/forms.scss @@ -0,0 +1,101 @@ +@import '../reset'; + +.form__logo { + width: 110px; + padding-top: 50px; + display: block; + margin: auto; + position: relative; + top: 20%; + transform: translate(0%, -40.9%); +} + +.form__brand { + padding: 10px 0; + text-align: center; + position: relative; + top: 20%; + transform: translate(0%, -90.9%); +} + +.form-container { + max-width: 40%; + min-width: 20%; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -49.9%); + box-sizing: border-box; + margin: auto; + padding: 20px 0; +} + +.form__box { + border: 1px solid #eaecef; + background-color: #f6f8fa; + border-radius: 5px; + padding: 20px 0; +} + +.form__in-group { + display: block; + position: relative; + margin: auto; + max-width: 80%; + padding: 10px 0px; + + box-sizing: content-box; + + align-items: center; + align-content: center; +} + +.form__in-field { + display: block; + box-sizing: border-box; + margin: 10px 0; + padding: 10px 0; + width: 100%; +} + +.form__in-field--warn { + border: solid 1px red; +} + +.form__in-field--success { + border: solid 1px #2ea44f; +} + +.form__pw-recovery { + text-decoration: none; + color: rgb(3, 102, 214); + font-size: 0.8rem; +} + +.form__submit-button { + display: block; + border: 1px solid skyblue; + background: #2ea44f; + color: white; + height: 40px; + border-radius: 5px; + width: 80%; + margin: auto; +} + +.form__secondary-action { + display: block; + margin-top: 10px; +} + +.form__secondary-action__banner { + display: block; + margin: auto; + max-width: 80%; + text-align: center; +} + +.form__secondary-action__link { + text-decoration: none; + color: rgb(3, 102, 214); +} diff --git a/frontend/templates/index.html b/frontend/templates/auth/login/index.html similarity index 83% rename from frontend/templates/index.html rename to frontend/templates/auth/login/index.html index b6754253..efd4dcc2 100644 --- a/frontend/templates/index.html +++ b/frontend/templates/auth/login/index.html @@ -1,4 +1,4 @@ -<. include!("components/headers.html"); .> +<. include!("../../components/headers.html"); .>