Skip to content

Commit e22016f

Browse files
committed
Remove the reauth view
1 parent cf732ac commit e22016f

File tree

6 files changed

+6
-317
lines changed

6 files changed

+6
-317
lines changed

crates/handlers/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,6 @@ where
371371
get(self::views::login::get).post(self::views::login::post),
372372
)
373373
.route(mas_router::Logout::route(), post(self::views::logout::post))
374-
.route(
375-
mas_router::Reauth::route(),
376-
get(self::views::reauth::get).post(self::views::reauth::post),
377-
)
378374
.route(
379375
mas_router::Register::route(),
380376
get(self::views::register::get),

crates/handlers/src/views/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ pub mod app;
88
pub mod index;
99
pub mod login;
1010
pub mod logout;
11-
pub mod reauth;
1211
pub mod recovery;
1312
pub mod register;
1413
pub mod shared;

crates/handlers/src/views/reauth.rs

Lines changed: 0 additions & 189 deletions
This file was deleted.

crates/router/src/endpoints.rs

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -255,66 +255,6 @@ impl SimpleRoute for Logout {
255255
const PATH: &'static str = "/logout";
256256
}
257257

258-
/// `GET|POST /reauth`
259-
#[derive(Default, Debug, Clone)]
260-
pub struct Reauth {
261-
post_auth_action: Option<PostAuthAction>,
262-
}
263-
264-
impl Reauth {
265-
#[must_use]
266-
pub fn and_then(action: PostAuthAction) -> Self {
267-
Self {
268-
post_auth_action: Some(action),
269-
}
270-
}
271-
272-
#[must_use]
273-
pub fn and_continue_grant(data: Ulid) -> Self {
274-
Self {
275-
post_auth_action: Some(PostAuthAction::continue_grant(data)),
276-
}
277-
}
278-
279-
#[must_use]
280-
pub fn and_continue_device_code_grant(data: Ulid) -> Self {
281-
Self {
282-
post_auth_action: Some(PostAuthAction::continue_device_code_grant(data)),
283-
}
284-
}
285-
286-
/// Get a reference to the reauth's post auth action.
287-
#[must_use]
288-
pub fn post_auth_action(&self) -> Option<&PostAuthAction> {
289-
self.post_auth_action.as_ref()
290-
}
291-
292-
pub fn go_next(&self, url_builder: &UrlBuilder) -> axum::response::Redirect {
293-
match &self.post_auth_action {
294-
Some(action) => action.go_next(url_builder),
295-
None => url_builder.redirect(&Index),
296-
}
297-
}
298-
}
299-
300-
impl Route for Reauth {
301-
type Query = PostAuthAction;
302-
303-
fn route() -> &'static str {
304-
"/reauth"
305-
}
306-
307-
fn query(&self) -> Option<&Self::Query> {
308-
self.post_auth_action.as_ref()
309-
}
310-
}
311-
312-
impl From<Option<PostAuthAction>> for Reauth {
313-
fn from(post_auth_action: Option<PostAuthAction>) -> Self {
314-
Self { post_auth_action }
315-
}
316-
}
317-
318258
/// `POST /register`
319259
#[derive(Default, Debug, Clone)]
320260
pub struct Register {

crates/templates/src/context.rs

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ impl FormField for LoginFormField {
381381
}
382382
}
383383

384-
/// Inner context used in login and reauth screens. See [`PostAuthContext`].
384+
/// Inner context used in login screen. See [`PostAuthContext`].
385385
#[derive(Serialize)]
386386
#[serde(tag = "kind", rename_all = "snake_case")]
387387
pub enum PostAuthContextInner {
@@ -420,7 +420,7 @@ pub enum PostAuthContextInner {
420420
ManageAccount,
421421
}
422422

423-
/// Context used in login and reauth screens, for the post-auth action to do
423+
/// Context used in login screen, for the post-auth action to do
424424
#[derive(Serialize)]
425425
pub struct PostAuthContext {
426426
/// The post auth action params from the URL
@@ -734,59 +734,6 @@ impl PolicyViolationContext {
734734
}
735735
}
736736

737-
/// Fields of the reauthentication form
738-
#[derive(Serialize, Deserialize, Debug, Clone, Copy, Hash, PartialEq, Eq)]
739-
#[serde(rename_all = "kebab-case")]
740-
pub enum ReauthFormField {
741-
/// The password field
742-
Password,
743-
}
744-
745-
impl FormField for ReauthFormField {
746-
fn keep(&self) -> bool {
747-
match self {
748-
Self::Password => false,
749-
}
750-
}
751-
}
752-
753-
/// Context used by the `reauth.html` template
754-
#[derive(Serialize, Default)]
755-
pub struct ReauthContext {
756-
form: FormState<ReauthFormField>,
757-
next: Option<PostAuthContext>,
758-
}
759-
760-
impl TemplateContext for ReauthContext {
761-
fn sample(_now: chrono::DateTime<Utc>, _rng: &mut impl Rng) -> Vec<Self>
762-
where
763-
Self: Sized,
764-
{
765-
// TODO: samples with errors
766-
vec![ReauthContext {
767-
form: FormState::default(),
768-
next: None,
769-
}]
770-
}
771-
}
772-
773-
impl ReauthContext {
774-
/// Add an error on the reauthentication form
775-
#[must_use]
776-
pub fn with_form_state(self, form: FormState<ReauthFormField>) -> Self {
777-
Self { form, ..self }
778-
}
779-
780-
/// Add a post authentication action to the context
781-
#[must_use]
782-
pub fn with_post_action(self, next: PostAuthContext) -> Self {
783-
Self {
784-
next: Some(next),
785-
..self
786-
}
787-
}
788-
}
789-
790737
/// Context used by the `sso.html` template
791738
#[derive(Serialize)]
792739
pub struct CompatSsoContext {

crates/templates/src/lib.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ pub use self::{
3838
DeviceConsentContext, DeviceLinkContext, DeviceLinkFormField, EmailRecoveryContext,
3939
EmailVerificationContext, EmptyContext, ErrorContext, FormPostContext, IndexContext,
4040
LoginContext, LoginFormField, NotFoundContext, PasswordRegisterContext,
41-
PolicyViolationContext, PostAuthContext, PostAuthContextInner, ReauthContext,
42-
ReauthFormField, RecoveryExpiredContext, RecoveryFinishContext, RecoveryFinishFormField,
43-
RecoveryProgressContext, RecoveryStartContext, RecoveryStartFormField, RegisterContext,
44-
RegisterFormField, RegisterStepsDisplayNameContext, RegisterStepsDisplayNameFormField,
41+
PolicyViolationContext, PostAuthContext, PostAuthContextInner, RecoveryExpiredContext,
42+
RecoveryFinishContext, RecoveryFinishFormField, RecoveryProgressContext,
43+
RecoveryStartContext, RecoveryStartFormField, RegisterContext, RegisterFormField,
44+
RegisterStepsDisplayNameContext, RegisterStepsDisplayNameFormField,
4545
RegisterStepsEmailInUseContext, RegisterStepsVerifyEmailContext,
4646
RegisterStepsVerifyEmailFormField, SiteBranding, SiteConfigExt, SiteFeatures,
4747
TemplateContext, UpstreamExistingLinkContext, UpstreamRegister, UpstreamRegisterFormField,
@@ -372,9 +372,6 @@ register_templates! {
372372
/// Render the account recovery disabled page
373373
pub fn render_recovery_disabled(WithLanguage<EmptyContext>) { "pages/recovery/disabled.html" }
374374

375-
/// Render the re-authentication form
376-
pub fn render_reauth(WithLanguage<WithCsrf<WithSession<ReauthContext>>>) { "pages/reauth.html" }
377-
378375
/// Render the form used by the form_post response mode
379376
pub fn render_form_post<T: Serialize>(WithLanguage<FormPostContext<T>>) { "form_post.html" }
380377

@@ -456,7 +453,6 @@ impl Templates {
456453
check::render_recovery_expired(self, now, rng)?;
457454
check::render_recovery_consumed(self, now, rng)?;
458455
check::render_recovery_disabled(self, now, rng)?;
459-
check::render_reauth(self, now, rng)?;
460456
check::render_form_post::<EmptyContext>(self, now, rng)?;
461457
check::render_error(self, now, rng)?;
462458
check::render_email_verification_txt(self, now, rng)?;

0 commit comments

Comments
 (0)