diff --git a/kitsune/src/http/handler/oauth/authorize.rs b/kitsune/src/http/handler/oauth/authorize.rs index 0555941f9..7cf5ae42d 100644 --- a/kitsune/src/http/handler/oauth/authorize.rs +++ b/kitsune/src/http/handler/oauth/authorize.rs @@ -1,10 +1,9 @@ use crate::oauth2::{OAuthEndpoint, OAuthOwnerSolicitor}; use argon2::{Argon2, PasswordHash, PasswordVerifier}; -use askama::Template; use axum::{ debug_handler, extract::{OriginalUri, State}, - response::Redirect, + response::{Html, Redirect}, Form, }; use axum_extra::{ @@ -50,12 +49,12 @@ pub struct LoginForm { password: String, } -#[derive(Template)] -#[template(path = "oauth/login.html")] +#[derive(Serialize)] pub struct LoginPage { flash_messages: IncomingFlashes, } +#[debug_handler(state = crate::state::Zustand)] pub async fn get( #[cfg(feature = "oidc")] (State(oidc_service), Query(query)): ( State>, @@ -68,7 +67,7 @@ pub async fn get( csrf_handle: CsrfHandle, flash_messages: IncomingFlashes, oauth_req: OAuthRequest, -) -> Result> { +) -> Result, Redirect>> { #[cfg(feature = "oidc")] if let Some(oidc_service) = oidc_service { let application = with_connection!(db_pool, |db_conn| { diff --git a/kitsune/src/oauth2/mod.rs b/kitsune/src/oauth2/mod.rs index d6fee03cb..eb8c432f2 100644 --- a/kitsune/src/oauth2/mod.rs +++ b/kitsune/src/oauth2/mod.rs @@ -50,7 +50,7 @@ fn chrono_to_timestamp(ts: chrono::DateTime) -> iso8601_timestamp::Timestam .into() } -#[derive(AsRefStr, Clone, Copy, Debug, EnumIter, EnumMessage, EnumString)] +#[derive(AsRefStr, Clone, Copy, Debug, EnumIter, EnumMessage, EnumString, Serialize)] #[strum(serialize_all = "lowercase")] pub enum OAuthScope { #[strum(message = "Read admin-related data", serialize = "admin:read")] diff --git a/kitsune/templates/base.html b/kitsune/templates/base.html index 81b9cbd43..e8c82c8c5 100644 --- a/kitsune/templates/base.html +++ b/kitsune/templates/base.html @@ -5,9 +5,6 @@ - - {% block head %} {% endblock %} - {% block title %} {% endblock %} diff --git a/kitsune/templates/oauth/consent.html b/kitsune/templates/oauth/consent.html index bbc79cfec..96ef0ec26 100644 --- a/kitsune/templates/oauth/consent.html +++ b/kitsune/templates/oauth/consent.html @@ -1,53 +1,51 @@ -{% extends "../base.html" %} +{% extends "base.html" %} -{% block title %} - OAuth Login -{% endblock %} - -{% macro add_query_params() %} - - - - - - -{% endmacro %} +
+{% block title %} OAuth Login {% endblock %} -{% block body %} -

- Kitsune -

+
+{% macro add_query_params() -%} + + + + + + +{%- endmacro %} {% block body %} +

Kitsune

- + - -
- Authenticated as {{ authenticated_username }} ~ - Logout -
+
+ Authenticated as + {{ authenticated_username }} ~ + Logout +
{% endblock %} diff --git a/kitsune/templates/oauth/login.html b/kitsune/templates/oauth/login.html index e92724f06..09fffecc2 100644 --- a/kitsune/templates/oauth/login.html +++ b/kitsune/templates/oauth/login.html @@ -1,5 +1,10 @@ -{% extends "../base.html" %} {% block title %}OAuth Login{% endblock %} {% block -body %} +{% extends "base.html" %} + +
+{% block title %}OAuth Login{% endblock %} + +
+{% block body %}

Kitsune

{% for (_level, msg) in flash_messages %} @@ -8,22 +13,24 @@
-
- Username +

-
+ /> +



+ /> + +

diff --git a/kitsune/templates/oauth/token.html b/kitsune/templates/oauth/token.html index 75af4ccba..24bb43aaf 100644 --- a/kitsune/templates/oauth/token.html +++ b/kitsune/templates/oauth/token.html @@ -1,5 +1,10 @@ -{% extends "../base.html" %} {% block title %} OAuth Token {% endblock %} {% -block body %} +{% extends "base.html" %} + +
+{% block title %} OAuth Token {% endblock %} + +
+{% block body %}

{{domain}}