-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Catch
secure-index
anywhere in the subdirectories
Store secure-index in user's session info Create custom responses for not found and restricted Add todo sections
- Loading branch information
1 parent
825c2a7
commit 5ea21e1
Showing
13 changed files
with
113 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use actix_web::http::StatusCode; | ||
use actix_web::HttpResponse; | ||
use minijinja::Template; | ||
|
||
// todo: write docstrings | ||
|
||
pub fn not_found(error: Template, description: &String) -> HttpResponse { | ||
HttpResponse::build(StatusCode::NOT_FOUND) | ||
.content_type("text/html; charset=utf-8") | ||
.body(error.render(minijinja::context!( | ||
title => "CONTENT UNAVAILABLE", | ||
description => description, | ||
help => r"Lost your way?\n\nHit the HOME button to navigate back to home page.", | ||
button_text => "HOME", button_link => "/home" | ||
)).unwrap()) | ||
} | ||
|
||
pub fn restricted(error: Template, username: &String) -> HttpResponse { | ||
HttpResponse::build(StatusCode::UNAUTHORIZED) | ||
.content_type("text/html; charset=utf-8") | ||
.body(error.render(minijinja::context!( | ||
title => "RESTRICTED SECTION", | ||
description => format!("This content is not accessible, as it does not belong to the user profile '{}'", username), | ||
help => r"Lost your way?\n\nHit the HOME button to navigate back to home page.", | ||
button_text => "HOME", button_link => "/home" | ||
)).unwrap()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters