Skip to content

Commit 1f83b39

Browse files
committed
Remove the dedicated page to add an email address
1 parent 75526ff commit 1f83b39

File tree

7 files changed

+10
-297
lines changed

7 files changed

+10
-297
lines changed

crates/handlers/src/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -383,11 +383,6 @@ where
383383
get(self::views::account::emails::verify::get)
384384
.post(self::views::account::emails::verify::post),
385385
)
386-
.route(
387-
mas_router::AccountAddEmail::route(),
388-
get(self::views::account::emails::add::get)
389-
.post(self::views::account::emails::add::post),
390-
)
391386
.route(
392387
mas_router::AccountRecoveryStart::route(),
393388
get(self::views::recovery::start::get).post(self::views::recovery::start::post),

crates/handlers/src/views/account/emails/add.rs

Lines changed: 0 additions & 167 deletions
This file was deleted.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
// Copyright 2024 New Vector Ltd.
1+
// Copyright 2024, 2025 New Vector Ltd.
22
// Copyright 2022-2024 The Matrix.org Foundation C.I.C.
33
//
44
// SPDX-License-Identifier: AGPL-3.0-only
55
// Please see LICENSE in the repository root for full details.
66

7-
pub mod add;
87
pub mod verify;

crates/router/src/endpoints.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -488,31 +488,6 @@ impl Route for AccountVerifyEmail {
488488
}
489489
}
490490

491-
/// `GET /add-email`
492-
#[derive(Default, Debug, Clone)]
493-
pub struct AccountAddEmail {
494-
post_auth_action: Option<PostAuthAction>,
495-
}
496-
497-
impl Route for AccountAddEmail {
498-
type Query = PostAuthAction;
499-
fn route() -> &'static str {
500-
"/add-email"
501-
}
502-
503-
fn query(&self) -> Option<&Self::Query> {
504-
self.post_auth_action.as_ref()
505-
}
506-
}
507-
508-
impl AccountAddEmail {
509-
#[must_use]
510-
pub fn and_then(mut self, action: PostAuthAction) -> Self {
511-
self.post_auth_action = Some(action);
512-
self
513-
}
514-
}
515-
516491
/// Actions parameters as defined by MSC2965
517492
#[derive(Debug, Clone, Serialize, Deserialize)]
518493
#[serde(tag = "action")]

crates/templates/src/context.rs

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -992,51 +992,6 @@ impl TemplateContext for EmailVerificationPageContext {
992992
}
993993
}
994994

995-
/// Fields of the account email add form
996-
#[derive(Serialize, Deserialize, Debug, Clone, Copy, Hash, PartialEq, Eq)]
997-
#[serde(rename_all = "snake_case")]
998-
pub enum EmailAddFormField {
999-
/// The email
1000-
Email,
1001-
}
1002-
1003-
impl FormField for EmailAddFormField {
1004-
fn keep(&self) -> bool {
1005-
match self {
1006-
Self::Email => true,
1007-
}
1008-
}
1009-
}
1010-
1011-
/// Context used by the `pages/account/verify.html` templates
1012-
#[derive(Serialize, Default)]
1013-
pub struct EmailAddContext {
1014-
form: FormState<EmailAddFormField>,
1015-
}
1016-
1017-
impl EmailAddContext {
1018-
/// Constructs a context for the email add page
1019-
#[must_use]
1020-
pub fn new() -> Self {
1021-
Self::default()
1022-
}
1023-
1024-
/// Set the form state
1025-
#[must_use]
1026-
pub fn with_form_state(form: FormState<EmailAddFormField>) -> Self {
1027-
Self { form }
1028-
}
1029-
}
1030-
1031-
impl TemplateContext for EmailAddContext {
1032-
fn sample(_now: chrono::DateTime<Utc>, _rng: &mut impl Rng) -> Vec<Self>
1033-
where
1034-
Self: Sized,
1035-
{
1036-
vec![Self::default()]
1037-
}
1038-
}
1039-
1040995
/// Fields of the account recovery start form
1041996
#[derive(Serialize, Deserialize, Debug, Clone, Copy, Hash, PartialEq, Eq)]
1042997
#[serde(rename_all = "snake_case")]

crates/templates/src/lib.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,15 @@ mod macros;
3535
pub use self::{
3636
context::{
3737
ApiDocContext, AppContext, CompatSsoContext, ConsentContext, DeviceConsentContext,
38-
DeviceLinkContext, DeviceLinkFormField, EmailAddContext, EmailRecoveryContext,
39-
EmailVerificationContext, EmailVerificationPageContext, EmptyContext, ErrorContext,
40-
FormPostContext, IndexContext, LoginContext, LoginFormField, NotFoundContext,
41-
PasswordRegisterContext, PolicyViolationContext, PostAuthContext, PostAuthContextInner,
42-
ReauthContext, ReauthFormField, RecoveryExpiredContext, RecoveryFinishContext,
43-
RecoveryFinishFormField, RecoveryProgressContext, RecoveryStartContext,
44-
RecoveryStartFormField, RegisterContext, RegisterFormField, SiteBranding, SiteConfigExt,
45-
SiteFeatures, TemplateContext, UpstreamExistingLinkContext, UpstreamRegister,
46-
UpstreamRegisterFormField, UpstreamSuggestLink, WithCaptcha, WithCsrf, WithLanguage,
47-
WithOptionalSession, WithSession,
38+
DeviceLinkContext, DeviceLinkFormField, EmailRecoveryContext, EmailVerificationContext,
39+
EmailVerificationPageContext, EmptyContext, ErrorContext, FormPostContext, IndexContext,
40+
LoginContext, LoginFormField, NotFoundContext, PasswordRegisterContext,
41+
PolicyViolationContext, PostAuthContext, PostAuthContextInner, ReauthContext,
42+
ReauthFormField, RecoveryExpiredContext, RecoveryFinishContext, RecoveryFinishFormField,
43+
RecoveryProgressContext, RecoveryStartContext, RecoveryStartFormField, RegisterContext,
44+
RegisterFormField, SiteBranding, SiteConfigExt, SiteFeatures, TemplateContext,
45+
UpstreamExistingLinkContext, UpstreamRegister, UpstreamRegisterFormField,
46+
UpstreamSuggestLink, WithCaptcha, WithCsrf, WithLanguage, WithOptionalSession, WithSession,
4847
},
4948
forms::{FieldError, FormError, FormField, FormState, ToFormState},
5049
};
@@ -347,9 +346,6 @@ register_templates! {
347346
/// Render the email verification page
348347
pub fn render_account_verify_email(WithLanguage<WithCsrf<WithSession<EmailVerificationPageContext>>>) { "pages/account/emails/verify.html" }
349348

350-
/// Render the email verification page
351-
pub fn render_account_add_email(WithLanguage<WithCsrf<WithSession<EmailAddContext>>>) { "pages/account/emails/add.html" }
352-
353349
/// Render the account recovery start page
354350
pub fn render_recovery_start(WithLanguage<WithCsrf<RecoveryStartContext>>) { "pages/recovery/start.html" }
355351

@@ -433,7 +429,6 @@ impl Templates {
433429
check::render_policy_violation(self, now, rng)?;
434430
check::render_sso_login(self, now, rng)?;
435431
check::render_index(self, now, rng)?;
436-
check::render_account_add_email(self, now, rng)?;
437432
check::render_account_verify_email(self, now, rng)?;
438433
check::render_recovery_start(self, now, rng)?;
439434
check::render_recovery_progress(self, now, rng)?;

templates/pages/account/emails/add.html

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

0 commit comments

Comments
 (0)