diff --git a/app/src/components/app.rs b/app/src/components/app.rs
index ebc50c6..613e583 100644
--- a/app/src/components/app.rs
+++ b/app/src/components/app.rs
@@ -7,6 +7,7 @@ use crate::{
group_table::GroupTable,
login::LoginForm,
logout::LogoutButton,
+ reset_password_step1::ResetPasswordStep1Form,
router::{AppRoute, Link, NavButton},
user_details::UserDetails,
user_table::UserTable,
@@ -101,40 +102,7 @@ impl Component for App {
- render = Router::render(move |switch: AppRoute| {
- match switch {
- AppRoute::Login => html! {
-
- },
- AppRoute::CreateUser => html! {
-
- },
- AppRoute::Index | AppRoute::ListUsers => html! {
-
-
- {"Create a user"}
-
- },
- AppRoute::CreateGroup => html! {
-
- },
- AppRoute::ListGroups => html! {
-
-
- {"Create a group"}
-
- },
- AppRoute::GroupDetails(group_id) => html! {
-
- },
- AppRoute::UserDetails(username) => html! {
-
- },
- AppRoute::ChangePassword(username) => html! {
-
- }
- }
- })
+ render = Router::render(move |s| Self::dispatch_route(s, &link, is_admin))
/>
@@ -147,7 +115,11 @@ impl App {
fn get_redirect_route() -> Option {
let route_service = RouteService::<()>::new();
let current_route = route_service.get_path();
- if current_route.is_empty() || current_route == "/" || current_route.contains("login") {
+ if current_route.is_empty()
+ || current_route == "/"
+ || current_route.contains("login")
+ || current_route.contains("reset-password")
+ {
None
} else {
use yew_router::Switch;
@@ -156,6 +128,11 @@ impl App {
}
fn apply_initial_redirections(&mut self) {
+ let route_service = RouteService::<()>::new();
+ let current_route = route_service.get_path();
+ if current_route.contains("reset-password") {
+ return;
+ }
match &self.user_info {
None => {
self.route_dispatcher
@@ -181,6 +158,44 @@ impl App {
}
}
+ fn dispatch_route(switch: AppRoute, link: &ComponentLink, is_admin: bool) -> Html {
+ match switch {
+ AppRoute::Login => html! {
+
+ },
+ AppRoute::CreateUser => html! {
+
+ },
+ AppRoute::Index | AppRoute::ListUsers => html! {
+
+
+ {"Create a user"}
+
+ },
+ AppRoute::CreateGroup => html! {
+
+ },
+ AppRoute::ListGroups => html! {
+
+
+ {"Create a group"}
+
+ },
+ AppRoute::GroupDetails(group_id) => html! {
+
+ },
+ AppRoute::UserDetails(username) => html! {
+
+ },
+ AppRoute::ChangePassword(username) => html! {
+
+ },
+ AppRoute::StartResetPassword => html! {
+
+ },
+ }
+ }
+
fn view_banner(&self) -> Html {
html! {