Skip to content

Commit

Permalink
App Passwords support
Browse files Browse the repository at this point in the history
  • Loading branch information
mdecimus committed Jun 30, 2024
1 parent 4df959b commit 467a93c
Show file tree
Hide file tree
Showing 8 changed files with 523 additions and 8 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).

## [0.1.7] - 2024-07-01

## Added
- Two-factor authentication with TOTP.
- Application passwords.

### Changed

### Fixed

## [0.1.6] - 2024-06-22

## Added
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ homepage = "https://stalw.art"
keywords = ["web", "admin", "email", "mail", "server"]
categories = ["email"]
license = "AGPL-3.0-only OR LicenseRef-SEL"
version = "0.1.6"
version = "0.1.7"
edition = "2021"
resolver = "2"

Expand Down
16 changes: 16 additions & 0 deletions src/components/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,3 +561,19 @@ pub fn IconHeart(
</SvgWrapper>
}
}

#[component]
pub fn IconSquare2x2(
#[prop(optional)] size: Option<usize>,
#[prop(attrs)] attrs: Vec<(&'static str, Attribute)>,
) -> impl IntoView {
view! {
<SvgWrapper size attrs>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25A2.25 2.25 0 0 1 13.5 18v-2.25Z"
></path>
</SvgWrapper>
}
}
23 changes: 20 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::{sync::Arc, time::Duration};
use components::{
icon::{
IconAdjustmentsHorizontal, IconDocumentChartBar, IconDocumentText, IconKey, IconLockClosed,
IconQueueList, IconShieldCheck, IconUserGroup, IconWrench,
IconQueueList, IconShieldCheck, IconSquare2x2, IconUserGroup, IconWrench,
},
layout::MenuItem,
};
Expand All @@ -20,7 +20,7 @@ use leptos::*;
use leptos_meta::*;
use leptos_router::*;
use pages::{
account::mfa::ManageMfa,
account::{app_password::{AppPasswordCreate, AppPasswords}, mfa::ManageMfa},
config::edit::DEFAULT_SETTINGS_URL,
manage::spam::{SpamTest, SpamTrain},
};
Expand Down Expand Up @@ -294,6 +294,18 @@ pub fn App() -> impl IntoView {
redirect_path="/login"
condition=move || is_logged_in.get()
/>
<ProtectedRoute
path="/app-passwords"
view=AppPasswords
redirect_path="/login"
condition=move || is_logged_in.get()
/>
<ProtectedRoute
path="/app-passwords/edit"
view=AppPasswordCreate
redirect_path="/login"
condition=move || is_logged_in.get()
/>

</ProtectedRoute>

Expand Down Expand Up @@ -380,10 +392,14 @@ impl LayoutBuilder {
.icon(view! { <IconKey/> })
.route("/password")
.insert()
.create("Two-Factor Auth")
.create("Two-factor Auth")
.icon(view! { <IconShieldCheck/> })
.route("/mfa")
.insert()
.create("App Passwords")
.icon(view! { <IconSquare2x2/> })
.route("/app-passwords")
.insert()
.menu_items
}
}
Expand Down Expand Up @@ -413,6 +429,7 @@ pub fn build_schemas() -> Arc<Schemas> {
.build_crypto()
.build_authorize()
.build_mfa()
.build_app_passwords()
.build()
.into()
}
Loading

0 comments on commit 467a93c

Please sign in to comment.