show password compoenent

This commit is contained in:
realaravinth
2021-05-15 21:36:52 +05:30
parent 6b740a980b
commit 0421cb681c
7 changed files with 33 additions and 10 deletions

13
Cargo.lock generated
View File

@@ -281,7 +281,7 @@ dependencies = [
"actix-threadpool", "actix-threadpool",
"actix-tls", "actix-tls",
"actix-utils", "actix-utils",
"actix-web-codegen", "actix-web-codegen 0.4.0",
"awc", "awc",
"bytes 0.5.6", "bytes 0.5.6",
"derive_more", "derive_more",
@@ -314,6 +314,16 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "actix-web-codegen"
version = "0.5.0-beta.2"
source = "git+https://github.com/realaravinth/actix-web#b91607bfb263d101c4a33b2b9b01b2093c1713d0"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "actix_derive" name = "actix_derive"
version = "0.5.0" version = "0.5.0"
@@ -1301,6 +1311,7 @@ dependencies = [
"actix-rt", "actix-rt",
"actix-service", "actix-service",
"actix-web", "actix-web",
"actix-web-codegen 0.5.0-beta.2",
"argon2-creds", "argon2-creds",
"cache-buster", "cache-buster",
"config", "config",

View File

@@ -29,6 +29,7 @@ actix-http = "2.2"
actix-rt = "1" actix-rt = "1"
actix-cors= "0.5.4" actix-cors= "0.5.4"
actix-service = "1.0.6" actix-service = "1.0.6"
my-codegen = {package = "actix-web-codegen", git ="https://github.com/realaravinth/actix-web"}
mime_guess = "2.0.3" mime_guess = "2.0.3"

View File

@@ -27,6 +27,8 @@ use crate::errors::*;
use crate::Data; use crate::Data;
use crate::*; use crate::*;
pub const AUTH: routes::Auth = routes::Auth::new();
pub mod routes { pub mod routes {
pub struct Auth { pub struct Auth {
pub login: &'static str, pub login: &'static str,

View File

@@ -18,6 +18,8 @@
use actix_web::{HttpResponse, Responder}; use actix_web::{HttpResponse, Responder};
use lazy_static::lazy_static; use lazy_static::lazy_static;
use sailfish::TemplateOnce; use sailfish::TemplateOnce;
use my_codegen::get;
use crate::PAGES;
#[derive(Clone, TemplateOnce)] #[derive(Clone, TemplateOnce)]
#[template(path = "auth/login/index.html")] #[template(path = "auth/login/index.html")]
@@ -35,7 +37,11 @@ lazy_static! {
static ref INDEX: String = IndexPage::default().render_once().unwrap(); static ref INDEX: String = IndexPage::default().render_once().unwrap();
} }
const ROUTE: &str = PAGES.auth.login;
#[get(path="ROUTE")]
pub async fn login() -> impl Responder { pub async fn login() -> impl Responder {
struct Foo;
HttpResponse::Ok() HttpResponse::Ok()
.content_type("text/html; charset=utf-8") .content_type("text/html; charset=utf-8")
.body(&*INDEX) .body(&*INDEX)

View File

@@ -22,7 +22,8 @@ pub fn services(cfg: &mut actix_web::web::ServiceConfig) {
use crate::define_resource; use crate::define_resource;
use crate::PAGES; use crate::PAGES;
define_resource!(cfg, PAGES.auth.login, Methods::Get, login::login); cfg.service(login::login);
// define_resource!(cfg, PAGES.auth.login, Methods::Get, login::login);
define_resource!(cfg, PAGES.auth.join, Methods::Get, register::join); define_resource!(cfg, PAGES.auth.join, Methods::Get, register::join);
} }

View File

@@ -8,7 +8,7 @@
<meta <meta
name="description" name="description"
content="HTML and CSS Tips and Tricks for creating applications that are both responsive and accessible out of the box" content="mCaptcha is an AGPL'd, privacy focued, proof-of-work based CAPTCHA System"
/> />
<meta name="author" content="Aravinth Manivannan" /> <meta name="author" content="Aravinth Manivannan" />
@@ -36,7 +36,8 @@
property="og:description" property="og:description"
content="mCaptcha is an AGPL'd, privacy focued, proof-of-work based CAPTCHA System" content="mCaptcha is an AGPL'd, privacy focued, proof-of-work based CAPTCHA System"
/> />
<meta property="og:site_name" content="Responsible Web Applications" /> <meta property="og:site_name"
content="mCaptcha is an AGPL'd, privacy focued, proof-of-work based CAPTCHA System"
/>
</head> </head>
<body class="layout"></body> <body class="layout">
</html>

View File

@@ -18,10 +18,11 @@
@import '../../vars'; @import '../../vars';
$img-height: 0.69; $img-height: 0.69;
$img-width: #{$form-input-height * $img-height};
@mixin show-password-img { @mixin show-password-img {
display: block; display: block;
width: #{$form-input-height * $img-height}; width: $img-width;
} }
.show-password--show { .show-password--show {
@@ -34,9 +35,9 @@ $img-height: 0.69;
} }
.show-password-container { .show-password-container {
position: absolute; position: relative;
right: 40px; top: -#{$form-input-height * ($img-height * 1.15)};
margin-top: #{$form-input-height * $img-height / 2.5}; left: #{$form-content-width * 0.99};
} }
.show-password-container:hover { .show-password-container:hover {