From 2ce8a46a3f1f1af8f817a9489de41f41b5a32ab9 Mon Sep 17 00:00:00 2001 From: realaravinth Date: Mon, 5 Apr 2021 16:38:32 +0530 Subject: [PATCH] panel --- Cargo.lock | 1 + frontend/Cargo.toml | 2 + frontend/package.json | 4 +- frontend/sailfish.yml | 1 + frontend/src/main.rs | 172 +++- frontend/static/img/svg/bell.svg | 1 + frontend/static/img/svg/credit-card.svg | 1 + frontend/static/img/svg/eye-off.svg | 1 + frontend/static/img/svg/eye.svg | 1 + frontend/static/img/svg/file-text.svg | 1 + frontend/static/img/svg/file.svg | 1 + frontend/static/img/svg/filter.svg | 1 + frontend/static/img/svg/github.svg | 1 + frontend/static/img/svg/globe.svg | 1 + frontend/static/img/svg/help-circle.svg | 1 + frontend/static/img/svg/home.svg | 1 + frontend/static/img/svg/log-out.svg | 1 + frontend/static/img/svg/menu.svg | 1 + frontend/static/img/svg/moon.svg | 1 + frontend/static/img/svg/settings.svg | 1 + frontend/static/img/svg/shield-off.svg | 1 + frontend/static/img/svg/shield.svg | 1 + frontend/static/img/svg/tag.svg | 1 + frontend/static/img/svg/toggle-left.svg | 1 + frontend/static/img/svg/toggle-right.svg | 1 + frontend/static/img/svg/user.svg | 1 + frontend/static/js/css/panel/main.scss | 147 ++++ frontend/static/js/css/panel/sidebar/main.css | 0 .../js/css/panel/sidebar/section/main.css | 0 frontend/static/js/index.js | 4 +- frontend/static/js/panel/index.js | 67 ++ frontend/templates/components/footers.html | 2 + .../components/{headers.stpl => headers.html} | 2 +- frontend/templates/{index.stpl => index.html} | 4 +- frontend/templates/panel/index.html | 48 + .../panel/nav/collapse-nav/index.html | 8 + frontend/templates/panel/nav/index.html | 20 + frontend/templates/panel/nav/menu/index.html | 5 + .../panel/nav/menu/section/heading.html | 3 + .../panel/nav/menu/section/index.html | 4 + .../panel/nav/menu/section/item.html | 24 + .../panel/nav/theme-toggle/index.html | 13 + frontend/templates/panel/style.html | 559 ++++++++++++ frontend/templates/signup/index.html | 65 ++ frontend/templates/signup/index.stpl | 31 - frontend/webpack.dev.js | 40 +- frontend/webpack.prod.js | 4 + mCaptcha-guard.postman_collection.json | 817 ------------------ templates/signin.stpl | 171 +--- 49 files changed, 1203 insertions(+), 1036 deletions(-) create mode 100644 frontend/sailfish.yml create mode 100644 frontend/static/img/svg/bell.svg create mode 100644 frontend/static/img/svg/credit-card.svg create mode 100644 frontend/static/img/svg/eye-off.svg create mode 100644 frontend/static/img/svg/eye.svg create mode 100644 frontend/static/img/svg/file-text.svg create mode 100644 frontend/static/img/svg/file.svg create mode 100644 frontend/static/img/svg/filter.svg create mode 100644 frontend/static/img/svg/github.svg create mode 100644 frontend/static/img/svg/globe.svg create mode 100644 frontend/static/img/svg/help-circle.svg create mode 100644 frontend/static/img/svg/home.svg create mode 100644 frontend/static/img/svg/log-out.svg create mode 100644 frontend/static/img/svg/menu.svg create mode 100644 frontend/static/img/svg/moon.svg create mode 100644 frontend/static/img/svg/settings.svg create mode 100644 frontend/static/img/svg/shield-off.svg create mode 100644 frontend/static/img/svg/shield.svg create mode 100644 frontend/static/img/svg/tag.svg create mode 100644 frontend/static/img/svg/toggle-left.svg create mode 100644 frontend/static/img/svg/toggle-right.svg create mode 100644 frontend/static/img/svg/user.svg create mode 100644 frontend/static/js/css/panel/main.scss create mode 100644 frontend/static/js/css/panel/sidebar/main.css create mode 100644 frontend/static/js/css/panel/sidebar/section/main.css create mode 100644 frontend/static/js/panel/index.js create mode 100644 frontend/templates/components/footers.html rename frontend/templates/components/{headers.stpl => headers.html} (77%) rename frontend/templates/{index.stpl => index.html} (94%) create mode 100644 frontend/templates/panel/index.html create mode 100644 frontend/templates/panel/nav/collapse-nav/index.html create mode 100644 frontend/templates/panel/nav/index.html create mode 100644 frontend/templates/panel/nav/menu/index.html create mode 100644 frontend/templates/panel/nav/menu/section/heading.html create mode 100644 frontend/templates/panel/nav/menu/section/index.html create mode 100644 frontend/templates/panel/nav/menu/section/item.html create mode 100644 frontend/templates/panel/nav/theme-toggle/index.html create mode 100644 frontend/templates/panel/style.html create mode 100644 frontend/templates/signup/index.html delete mode 100644 frontend/templates/signup/index.stpl delete mode 100644 mCaptcha-guard.postman_collection.json diff --git a/Cargo.lock b/Cargo.lock index be0aad88..fef0b6ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1118,6 +1118,7 @@ dependencies = [ name = "frontend" version = "0.1.0" dependencies = [ + "lazy_static", "log", "pretty_env_logger", "sailfish", diff --git a/frontend/Cargo.toml b/frontend/Cargo.toml index 6e47c2a4..59d37d7c 100644 --- a/frontend/Cargo.toml +++ b/frontend/Cargo.toml @@ -12,3 +12,5 @@ tokio = { version = "1.4.0", features = [ "rt-multi-thread", "macros", "fs", "te pretty_env_logger = "0.4" log = "0.4" + +lazy_static = "1.4" diff --git a/frontend/package.json b/frontend/package.json index 18a4ccaf..2d06e2c6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -7,7 +7,9 @@ "author": "Aravinth Manivannan ", "license": "AGPLv3 or above", "scripts": { - "start": "cargo run && webpack-dev-server --config webpack.dev.js --open", + "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": "cargo run && webpack --config webpack.prod.js" }, "private": true, diff --git a/frontend/sailfish.yml b/frontend/sailfish.yml new file mode 100644 index 00000000..5f64209e --- /dev/null +++ b/frontend/sailfish.yml @@ -0,0 +1 @@ +delimiter: "." diff --git a/frontend/src/main.rs b/frontend/src/main.rs index b7d90821..7b37af81 100644 --- a/frontend/src/main.rs +++ b/frontend/src/main.rs @@ -3,14 +3,35 @@ use sailfish::TemplateOnce; use tokio::fs; use tokio::io::{Error, ErrorKind}; -#[derive(TemplateOnce)] // automatically implement `TemplateOnce` trait -#[template(path = "index.stpl")] // specify the path to template +#[derive(Clone, TemplateOnce)] +#[template(path = "index.html")] struct IndexPage { - // data to be passed to the template name: String, title: String, } +impl Default for IndexPage { + fn default() -> Self { + IndexPage { + name: "mCaptcha".into(), + title: "Login".into(), + } + } +} + +impl IndexPage { + pub async fn run(&self) -> Result<(), Error> { + let file = root_path("index.html"); + + info!("rendering {}", &file); + let index = self.clone().render_once().unwrap(); + + fs::write(&file, index).await?; + info!("wrote {}", &file); + Ok(()) + } +} + const BASE_DIR: &str = "./output"; #[tokio::main] @@ -28,43 +49,132 @@ async fn main() { _ => (), }; - let ctx = IndexPage { - name: "mCaptcha".into(), - title: "Login".into(), - }; - - // Now render templates with given data - info!("rendering {}", path("index.html")); - let index = ctx.render_once().unwrap(); - fs::write(path("index.html"), index).await.unwrap(); - info!("wrote {}", path("index.html")); - - let ctx = signup::IndexPage { - name: "mCaptcha".into(), - title: "Register".into(), - }; - - // Now render templates with given data - info!("rendering {}", path("signup/index.html")); - let index = ctx.render_once().unwrap(); - fs::create_dir(path("signup")).await.unwrap(); - info!("creating dir {}", path("signup/")); - - fs::write(path("signup/index.html"), index).await.unwrap(); - info!("wrote {}", path("signup/index.html")); + IndexPage::default().run().await.unwrap(); + signup::IndexPage::default().run().await.unwrap(); + panel::IndexPage::default().run().await.unwrap(); } -fn path(rel: &str) -> String { +fn root_path(rel: &str) -> String { format!("{}/{}", BASE_DIR, rel) } +fn rel_path(dir: &str, file: &str) -> String { + format!("{}/{}", dir, file) +} + mod signup { use super::*; - #[derive(TemplateOnce)] // automatically implement `TemplateOnce` trait - #[template(path = "signup/index.stpl", escape = false)] // specify the path to template + + #[derive(TemplateOnce, Clone)] + #[template(path = "signup/index.html")] pub struct IndexPage { - // data to be passed to the template pub name: String, pub title: String, } + + impl Default for IndexPage { + fn default() -> Self { + IndexPage { + name: "mCaptcha".into(), + title: "Join".into(), + } + } + } + + impl IndexPage { + pub async fn run(&self) -> Result<(), Error> { + let dir = root_path("signup"); + let file = rel_path(&dir, "index.html"); + + print!(""); + info!("rendering {}", &file); + let index = self.clone().render_once().unwrap(); + + fs::create_dir(&dir).await?; + info!("creating dir {}", &dir); + + fs::write(&file, index).await?; + info!("wrote {}", &file); + Ok(()) + } + } +} + +pub type Literal = &'static str; + +pub mod panel { + use super::*; + use section::*; + + #[derive(TemplateOnce, Clone)] + #[template(path = "panel/index.html")] + pub struct IndexPage { + pub name: String, + pub title: String, + pub active: &'static SubPanel, + } + + impl Default for IndexPage { + fn default() -> Self { + IndexPage { + name: "mCaptcha".into(), + title: "Home".into(), + active: &COMMENTS, + } + } + } + + impl IndexPage { + pub async fn run(&self) -> Result<(), Error> { + let dir = root_path("panel"); + let file = rel_path(&dir, "index.html"); + + info!("rendering {}", &file); + let index = self.clone().render_once().unwrap(); + + fs::create_dir(&dir).await?; + info!("creating dir {}", &dir); + + fs::write(&file, index).await?; + info!("wrote {}", &file); + Ok(()) + } + } + + pub mod section { + use super::*; + + pub struct Section { + pub name: Literal, + pub elements: [&'static SubPanel; N], + } + + pub struct SubPanel { + pub name: Literal, + pub icon: Literal, + } + + macro_rules! sub_panel { + ($var:ident, $name:expr, $icon:expr) => { + pub static $var: SubPanel = SubPanel { + name: $name, + icon: $icon, + }; + }; + } + + sub_panel!(COMMENTS, "Comments", "comments"); + sub_panel!(USERS, "Users", "users"); + sub_panel!(PAGES, "Pages", "pages"); + + pub static ADMIN_SECTION: Section<3> = Section { + elements: [&COMMENTS, &USERS, &PAGES], + name: "Admin", + }; + + pub static SETTINGS_SECTION: Section<3> = Section { + elements: [&COMMENTS, &USERS, &PAGES], + name: "Settings", + }; + } } diff --git a/frontend/static/img/svg/bell.svg b/frontend/static/img/svg/bell.svg new file mode 100644 index 00000000..c0ed0e1e --- /dev/null +++ b/frontend/static/img/svg/bell.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/img/svg/credit-card.svg b/frontend/static/img/svg/credit-card.svg new file mode 100644 index 00000000..9429a635 --- /dev/null +++ b/frontend/static/img/svg/credit-card.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/img/svg/eye-off.svg b/frontend/static/img/svg/eye-off.svg new file mode 100644 index 00000000..9d28c182 --- /dev/null +++ b/frontend/static/img/svg/eye-off.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/img/svg/eye.svg b/frontend/static/img/svg/eye.svg new file mode 100644 index 00000000..44f107af --- /dev/null +++ b/frontend/static/img/svg/eye.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/img/svg/file-text.svg b/frontend/static/img/svg/file-text.svg new file mode 100644 index 00000000..85186e3b --- /dev/null +++ b/frontend/static/img/svg/file-text.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/img/svg/file.svg b/frontend/static/img/svg/file.svg new file mode 100644 index 00000000..fa1ecc84 --- /dev/null +++ b/frontend/static/img/svg/file.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/img/svg/filter.svg b/frontend/static/img/svg/filter.svg new file mode 100644 index 00000000..3ae2cfc7 --- /dev/null +++ b/frontend/static/img/svg/filter.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/img/svg/github.svg b/frontend/static/img/svg/github.svg new file mode 100644 index 00000000..8a1c9c0a --- /dev/null +++ b/frontend/static/img/svg/github.svg @@ -0,0 +1 @@ + diff --git a/frontend/static/img/svg/globe.svg b/frontend/static/img/svg/globe.svg new file mode 100644 index 00000000..4306cdcb --- /dev/null +++ b/frontend/static/img/svg/globe.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/img/svg/help-circle.svg b/frontend/static/img/svg/help-circle.svg new file mode 100644 index 00000000..1bbf3978 --- /dev/null +++ b/frontend/static/img/svg/help-circle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/img/svg/home.svg b/frontend/static/img/svg/home.svg new file mode 100644 index 00000000..867f0799 --- /dev/null +++ b/frontend/static/img/svg/home.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/img/svg/log-out.svg b/frontend/static/img/svg/log-out.svg new file mode 100644 index 00000000..625d2724 --- /dev/null +++ b/frontend/static/img/svg/log-out.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/img/svg/menu.svg b/frontend/static/img/svg/menu.svg new file mode 100644 index 00000000..0ea1741e --- /dev/null +++ b/frontend/static/img/svg/menu.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/img/svg/moon.svg b/frontend/static/img/svg/moon.svg new file mode 100644 index 00000000..3d94f162 --- /dev/null +++ b/frontend/static/img/svg/moon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/img/svg/settings.svg b/frontend/static/img/svg/settings.svg new file mode 100644 index 00000000..0318f2ce --- /dev/null +++ b/frontend/static/img/svg/settings.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/img/svg/shield-off.svg b/frontend/static/img/svg/shield-off.svg new file mode 100644 index 00000000..47805eed --- /dev/null +++ b/frontend/static/img/svg/shield-off.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/img/svg/shield.svg b/frontend/static/img/svg/shield.svg new file mode 100644 index 00000000..18c6ed24 --- /dev/null +++ b/frontend/static/img/svg/shield.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/img/svg/tag.svg b/frontend/static/img/svg/tag.svg new file mode 100644 index 00000000..0c7a7704 --- /dev/null +++ b/frontend/static/img/svg/tag.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/img/svg/toggle-left.svg b/frontend/static/img/svg/toggle-left.svg new file mode 100644 index 00000000..cd4b4e62 --- /dev/null +++ b/frontend/static/img/svg/toggle-left.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/img/svg/toggle-right.svg b/frontend/static/img/svg/toggle-right.svg new file mode 100644 index 00000000..01392ab6 --- /dev/null +++ b/frontend/static/img/svg/toggle-right.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/img/svg/user.svg b/frontend/static/img/svg/user.svg new file mode 100644 index 00000000..7b5bc4a7 --- /dev/null +++ b/frontend/static/img/svg/user.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/static/js/css/panel/main.scss b/frontend/static/js/css/panel/main.scss new file mode 100644 index 00000000..e67163e5 --- /dev/null +++ b/frontend/static/js/css/panel/main.scss @@ -0,0 +1,147 @@ +/* + diff --git a/frontend/templates/panel/nav/theme-toggle/index.html b/frontend/templates/panel/nav/theme-toggle/index.html new file mode 100644 index 00000000..b46b4e12 --- /dev/null +++ b/frontend/templates/panel/nav/theme-toggle/index.html @@ -0,0 +1,13 @@ +
+ + + +
diff --git a/frontend/templates/panel/style.html b/frontend/templates/panel/style.html new file mode 100644 index 00000000..8c277f21 --- /dev/null +++ b/frontend/templates/panel/style.html @@ -0,0 +1,559 @@ + diff --git a/frontend/templates/signup/index.html b/frontend/templates/signup/index.html new file mode 100644 index 00000000..238565b0 --- /dev/null +++ b/frontend/templates/signup/index.html @@ -0,0 +1,65 @@ +<. include!("../components/headers.html"); .> +
+ +

Join mCaptcha

+ +
+ + + + + + + + +
+
+

+ New to mCaptcha? + Create account +

+
+
+<. include!("../components/footers.html"); .> diff --git a/frontend/templates/signup/index.stpl b/frontend/templates/signup/index.stpl deleted file mode 100644 index d96322cf..00000000 --- a/frontend/templates/signup/index.stpl +++ /dev/null @@ -1,31 +0,0 @@ -<% include!("../components/headers.stpl"); %> - -
- -

Join mCaptcha

- -
- - - - -
-
-

- New to mCaptcha? - Create account -

-
-
- diff --git a/frontend/webpack.dev.js b/frontend/webpack.dev.js index c1e66c33..c60e8b24 100644 --- a/frontend/webpack.dev.js +++ b/frontend/webpack.dev.js @@ -1,34 +1,38 @@ -const path = require("path"); -const common = require("./webpack.common"); -const merge = require("webpack-merge"); -var HtmlWebpackPlugin = require("html-webpack-plugin"); +const path = require('path'); +const common = require('./webpack.common'); +const merge = require('webpack-merge'); +var HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = merge(common, { - mode: "development", + mode: 'development', output: { - filename: "[name].bundle.js", - path: path.resolve(__dirname, "dist") + filename: '[name].bundle.js', + path: path.resolve(__dirname, 'dist'), }, plugins: [ new HtmlWebpackPlugin({ - template: "./output/index.html" + template: './output/index.html', }), new HtmlWebpackPlugin({ - filename: "signup/index.html", - template: "./output/signup/index.html" - }) + filename: 'signup/index.html', + template: './output/signup/index.html', + }), + new HtmlWebpackPlugin({ + filename: 'panel/index.html', + template: './output/panel/index.html', + }), ], module: { rules: [ { test: /\.scss$/, use: [ - "style-loader", //3. Inject styles into DOM - "css-loader", //2. Turns css into commonjs - "sass-loader" //1. Turns sass into css - ] - } - ] - } + 'style-loader', //3. Inject styles into DOM + 'css-loader', //2. Turns css into commonjs + 'sass-loader', //1. Turns sass into css + ], + }, + ], + }, }); diff --git a/frontend/webpack.prod.js b/frontend/webpack.prod.js index e7c49161..1738c32c 100644 --- a/frontend/webpack.prod.js +++ b/frontend/webpack.prod.js @@ -34,6 +34,10 @@ module.exports = merge(common, { removeComments: true, }, }), + new HtmlWebpackPlugin({ + filename: 'panel/index.html', + template: './output/panel/index.html', + }), ], }, plugins: [ diff --git a/mCaptcha-guard.postman_collection.json b/mCaptcha-guard.postman_collection.json deleted file mode 100644 index 5257a5c3..00000000 --- a/mCaptcha-guard.postman_collection.json +++ /dev/null @@ -1,817 +0,0 @@ -{ - "info": { - "_postman_id": "75a16c22-17aa-43ca-8906-0cc33844f77e", - "name": "mCaptcha/guard", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "api/v1", - "item": [ - { - "name": "account", - "item": [ - { - "name": "Delete user account", - "request": { - "auth": { - "type": "apikey", - "apikey": [ - { - "key": "key", - "value": "Authorization", - "type": "string" - }, - { - "key": "value", - "value": true, - "type": "boolean" - }, - { - "key": "in", - "value": "header", - "type": "string" - } - ] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"password\": \"dolor aliquip laboris id\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/account/delete", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "account", - "delete" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [ - { - "description": { - "content": "Added as a part of security scheme: apikey", - "type": "text/plain" - }, - "key": "Authorization", - "value": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"password\": \"dolor aliquip laboris id\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/account/delete", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "account", - "delete" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "text/plain" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "(cookie)authentication required or wrong password", - "originalRequest": { - "method": "POST", - "header": [ - { - "description": { - "content": "Added as a part of security scheme: apikey", - "type": "text/plain" - }, - "key": "Authorization", - "value": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"password\": \"dolor aliquip laboris id\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/account/delete", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "account", - "delete" - ] - } - }, - "status": "Unauthorized", - "code": 401, - "_postman_previewlanguage": "json", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "cookie": [], - "body": "{\n \"error\": \"elit enim fugiat\"\n}" - }, - { - "name": "username not found", - "originalRequest": { - "method": "POST", - "header": [ - { - "description": { - "content": "Added as a part of security scheme: apikey", - "type": "text/plain" - }, - "key": "Authorization", - "value": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"password\": \"dolor aliquip laboris id\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/account/delete", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "account", - "delete" - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "json", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "cookie": [], - "body": "{\n \"error\": \"elit enim fugiat\"\n}" - }, - { - "name": "Internal server error", - "originalRequest": { - "method": "POST", - "header": [ - { - "description": { - "content": "Added as a part of security scheme: apikey", - "type": "text/plain" - }, - "key": "Authorization", - "value": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"password\": \"dolor aliquip laboris id\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/account/delete", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "account", - "delete" - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "json", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "cookie": [], - "body": "{\n \"error\": \"elit enim fugiat\"\n}" - } - ] - }, - { - "name": "Check if username exists", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"val\": \"eiusmod irure s\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/account/username/exists", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "account", - "username", - "exists" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"val\": \"eiusmod irure s\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/account/username/exists", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "account", - "username", - "exists" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "json", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "cookie": [], - "body": "{\n \"val\": false\n}" - }, - { - "name": "Internal server error", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"val\": \"eiusmod irure s\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/account/username/exists", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "account", - "username", - "exists" - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "json", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "cookie": [], - "body": "{\n \"error\": \"elit enim fugiat\"\n}" - } - ] - }, - { - "name": "Check if email exists", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"val\": \"eiusmod irure s\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/account/email/exists", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "account", - "email", - "exists" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"val\": \"eiusmod irure s\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/account/email/exists", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "account", - "email", - "exists" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "json", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "cookie": [], - "body": "{\n \"val\": false\n}" - }, - { - "name": "Internal server error", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"val\": \"eiusmod irure s\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/account/email/exists", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "account", - "email", - "exists" - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "json", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "cookie": [], - "body": "{\n \"error\": \"elit enim fugiat\"\n}" - } - ] - } - ] - }, - { - "name": "Registration endpoint", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"username\": \"adipisicing\",\n \"password\": \"quis ut ipsum culpa\",\n \"email\": \"fugiat dolor ullamco magna\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/signup", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "signup" - ] - } - }, - "response": [ - { - "name": "Bad request: username contains profainity/blacklisted words or email not acceptable or password too long/short or duplicate username/password", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"username\": \"adipisicing\",\n \"password\": \"quis ut ipsum culpa\",\n \"email\": \"fugiat dolor ullamco magna\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/signup", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "signup" - ] - } - }, - "status": "Bad Request", - "code": 400, - "_postman_previewlanguage": "json", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "cookie": [], - "body": "{\n \"error\": \"elit enim fugiat\"\n}" - }, - { - "name": "Successful registration", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"username\": \"adipisicing\",\n \"password\": \"quis ut ipsum culpa\",\n \"email\": \"fugiat dolor ullamco magna\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/signup", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "signup" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "text/plain" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal server error", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"username\": \"adipisicing\",\n \"password\": \"quis ut ipsum culpa\",\n \"email\": \"fugiat dolor ullamco magna\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/signup", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "signup" - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "json", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "cookie": [], - "body": "{\n \"error\": \"elit enim fugiat\"\n}" - } - ] - }, - { - "name": "Login endpoint", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"username\": \"voluptate proident nulla cupidatat do\",\n \"password\": \"sint ut commodo\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/signin", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "signin" - ] - } - }, - "response": [ - { - "name": "Successful authentication", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"username\": \"voluptate proident nulla cupidatat do\",\n \"password\": \"sint ut commodo\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/signin", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "signin" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "text/plain" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal server error", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"username\": \"voluptate proident nulla cupidatat do\",\n \"password\": \"sint ut commodo\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/signin", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "signin" - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "json", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "cookie": [], - "body": "{\n \"error\": \"elit enim fugiat\"\n}" - }, - { - "name": "username not found", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"username\": \"voluptate proident nulla cupidatat do\",\n \"password\": \"sint ut commodo\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/signin", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "signin" - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "json", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "cookie": [], - "body": "{\n \"error\": \"elit enim fugiat\"\n}" - }, - { - "name": "authentication failed, wrong password", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"username\": \"voluptate proident nulla cupidatat do\",\n \"password\": \"sint ut commodo\"\n}" - }, - "url": { - "raw": "{{baseUrl}}/api/v1/signin", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "signin" - ] - } - }, - "status": "Unauthorized", - "code": 401, - "_postman_previewlanguage": "json", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "cookie": [], - "body": "{\n \"error\": \"elit enim fugiat\"\n}" - } - ] - }, - { - "name": "Signout endpoint", - "request": { - "auth": { - "type": "apikey", - "apikey": [ - { - "key": "key", - "value": "Authorization", - "type": "string" - }, - { - "key": "value", - "value": true, - "type": "boolean" - }, - { - "key": "in", - "value": "header", - "type": "string" - } - ] - }, - "method": "POST", - "header": [], - "url": { - "raw": "{{baseUrl}}/api/v1/signout", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "signout" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [ - { - "description": { - "content": "Added as a part of security scheme: apikey", - "type": "text/plain" - }, - "key": "Authorization", - "value": "" - } - ], - "url": { - "raw": "{{baseUrl}}/api/v1/signout", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "api", - "v1", - "signout" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "text/plain" - } - ], - "cookie": [], - "body": "" - } - ] - } - ] - } - ], - "variable": [ - { - "key": "baseUrl", - "value": "http://localhost:3000", - "type": "string" - } - ] -} \ No newline at end of file diff --git a/templates/signin.stpl b/templates/signin.stpl index c9fffdf3..55257d23 100644 --- a/templates/signin.stpl +++ b/templates/signin.stpl @@ -1,138 +1,41 @@ -<% include!("./top.stpl"); %> +<. include!("./top.html"); .> Sign in | mCaptcha -

Sign in to mCaptcha

+

Sign in to mCaptcha

+
+
+ -
- - - - - - -
-

New to mCaptcha? Create account

-
-
- - - -<% include!("./bottom.stpl"); %> + + + +
+

+ New to mCaptcha? + Create account +

+
+
+<. include!("./bottom.html"); .>