mirror of
https://github.com/actix/examples
synced 2024-11-23 14:31:07 +01:00
Escape HTML (#366)
This commit is contained in:
parent
49e29a5751
commit
e3c6a1ec07
@ -15,7 +15,7 @@ futures = "0.3.1"
|
||||
log = "0.4.3"
|
||||
serde = { version = "1.0.69", features = ["derive"] }
|
||||
serde_json = "1.0.22"
|
||||
tera = "1.0"
|
||||
tera = "1.5.0"
|
||||
|
||||
[dependencies.diesel]
|
||||
features = ["postgres", "r2d2"]
|
||||
|
@ -33,7 +33,14 @@ async fn main() -> io::Result<()> {
|
||||
let app = move || {
|
||||
debug!("Constructing the App");
|
||||
|
||||
let templates: Tera = Tera::new("templates/**/*").unwrap();
|
||||
let mut templates = match Tera::new("templates/**/*") {
|
||||
Ok(t) => t,
|
||||
Err(e) => {
|
||||
println!("Parsing error(s): {}", e);
|
||||
::std::process::exit(1);
|
||||
}
|
||||
};
|
||||
templates.autoescape_on(vec!["tera"]);
|
||||
|
||||
let session_store = CookieSession::signed(SESSION_SIGNING_KEY).secure(false);
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
||||
{% else %}
|
||||
<form action="/todo/{{task.id}}" class="link" method="post">
|
||||
<input type="hidden" name="_method" value="put" />
|
||||
<button type="submit" class="link">{{ task.description }}</button>
|
||||
<button type="submit" class="link">{{task.description}}</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user