diff --git a/src/main.rs b/src/main.rs index e3bb297..c35c807 100644 --- a/src/main.rs +++ b/src/main.rs @@ -68,6 +68,8 @@ async fn main() { ) .route("/", get(index)) .route("/login", get(login)) + .route("/login_authorized", get(login_authorized)) + .route("/dashboard", get(dashboard)) .layer(Extension(store)) .layer(Extension(oauth_client)); @@ -242,7 +244,7 @@ where } // Valid user session required. If there is none, redirect to the auth page -async fn protected(user: User) -> impl IntoResponse { +async fn dashboard(user: User) -> impl IntoResponse { format!( "Welcome to the protected area :)\nHere's your info:\n{:?}", user @@ -311,7 +313,7 @@ async fn login_authorized( let mut headers = HeaderMap::new(); headers.insert(SET_COOKIE, cookie.parse().unwrap()); - (headers, Redirect::to("/".parse().unwrap())) + (headers, Redirect::to("/dashboard".parse().unwrap())) } struct AuthRedirect; diff --git a/templates/login.html b/templates/login.html index 2955d8e..cf8c580 100644 --- a/templates/login.html +++ b/templates/login.html @@ -1,4 +1,46 @@ {% extends "base.html" %} {% block content %} -Hello {{ name }} +
+
+
+
+
+
+ +

Sign in

+ +
+ + +
+ +
+ + +
+ + +
+ + +
+ + + +
+ + Sign in with google + + +
+
+
+
+
+
{% endblock content %} \ No newline at end of file