diff options
author | cel 🌸 <cel@blos.sm> | 2023-12-11 13:57:51 +0000 |
---|---|---|
committer | cel 🌸 <cel@blos.sm> | 2023-12-11 13:57:51 +0000 |
commit | 5dc4774ed3380762b4d7aadc86193af6073c456a (patch) | |
tree | cc8af98d94a0566ec19e4ca2f3cfd3800a7c5423 /templates | |
parent | 159b239aa2964f6c07438638b967746354376b2e (diff) | |
download | pinussy-5dc4774ed3380762b4d7aadc86193af6073c456a.tar.gz pinussy-5dc4774ed3380762b4d7aadc86193af6073c456a.tar.bz2 pinussy-5dc4774ed3380762b4d7aadc86193af6073c456a.zip |
implement log-out
Diffstat (limited to 'templates')
-rw-r--r-- | templates/base.rs.html | 8 | ||||
-rw-r--r-- | templates/home.rs.html | 10 | ||||
-rw-r--r-- | templates/login.rs.html | 2 | ||||
-rw-r--r-- | templates/signup.rs.html | 2 | ||||
-rw-r--r-- | templates/users.rs.html | 4 |
5 files changed, 18 insertions, 8 deletions
diff --git a/templates/base.rs.html b/templates/base.rs.html index 64a8d4e..0bf70eb 100644 --- a/templates/base.rs.html +++ b/templates/base.rs.html @@ -1,7 +1,7 @@ @use super::statics::*; @use crate::Notification; -@(authenticated: bool, notification: Option<Notification>, body: Content) +@(user: Option<String>, notification: Option<Notification>, body: Content) <!DOCTYPE html> <html> @@ -15,9 +15,9 @@ <body> <nav> - @if authenticated { + @if let Some(username) = user { <form action="/logout" method="post"> - <button type="submit">logout</button> + <button type="submit">logout @username</button> </form> } else { <a href="/login">log in</a> @@ -29,4 +29,4 @@ @:body() </body> -</html>
\ No newline at end of file +</html> diff --git a/templates/home.rs.html b/templates/home.rs.html new file mode 100644 index 0000000..882b2ed --- /dev/null +++ b/templates/home.rs.html @@ -0,0 +1,10 @@ +@use super::base_html; +@use crate::User; + +@(user: Option<String>) + +@:base_html(user.clone(), None, { + @if let Some(username) = user { + <h1>logged in as @username</h1> + } +}) diff --git a/templates/login.rs.html b/templates/login.rs.html index c87866c..8547bd0 100644 --- a/templates/login.rs.html +++ b/templates/login.rs.html @@ -3,7 +3,7 @@ @(notification: Option<Notification>) -@:base_html(false, None, { +@:base_html(None, None, { <form action="/login" method="post"> <label for="username">username:</label> <input type="text" id="username" name="username" required="true" /> diff --git a/templates/signup.rs.html b/templates/signup.rs.html index a482fc2..4823698 100644 --- a/templates/signup.rs.html +++ b/templates/signup.rs.html @@ -3,7 +3,7 @@ @(notification: Option<Notification>) -@:base_html(false, notification, { +@:base_html(None, notification, { <form action="/signup" method="post"> <label for="username">username:</label> <input type="text" id="username" name="username" required="true" /> diff --git a/templates/users.rs.html b/templates/users.rs.html index ab1ab0f..c5b98f9 100644 --- a/templates/users.rs.html +++ b/templates/users.rs.html @@ -3,10 +3,10 @@ @(users: Vec<User>) -@:base_html(false, None, { +@:base_html(None, None, { <ul> @for user in users { <li>@user.username</li> } </ul> -})
\ No newline at end of file +}) |