mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
feat: Add support for 3pid management
This commit is contained in:
@@ -8,7 +8,8 @@ pub trait MessageTemplate: Template {
|
||||
#[derive(Template)]
|
||||
#[template(path = "mail/change_email.txt")]
|
||||
pub struct ChangeEmail<'a> {
|
||||
pub user_id: &'a UserId,
|
||||
pub server_name: &'a str,
|
||||
pub user_id: Option<&'a UserId>,
|
||||
pub verification_link: String,
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
|
||||
{% block content -%}
|
||||
Hello!
|
||||
|
||||
{% if let Some(user_id) = user_id -%}
|
||||
Somebody, probably you, tried to associate this email address with the Matrix account {{ user_id }}.
|
||||
If that's your account, and this is your email address, click this link to proceed:
|
||||
{%- else -%}
|
||||
Somebody, probably you, tried to associate this email address with a Matrix account on {{ server_name }}.
|
||||
{%- endif %}
|
||||
If that was you, and this is your email address, click this link to proceed:
|
||||
{{ verification_link }}
|
||||
Otherwise, you can ignore this email. The above link will expire in one hour.
|
||||
{%- endblock %}
|
||||
|
||||
@@ -227,15 +227,15 @@ impl Service {
|
||||
///
|
||||
/// [`Self::get_localpart_for_email`] may be used if only the email is
|
||||
/// known.
|
||||
pub async fn disassociate_localpart_email(&self, localpart: &str) {
|
||||
let email = self
|
||||
.get_email_for_localpart(localpart)
|
||||
.await
|
||||
.expect("localpart has no email associated");
|
||||
pub async fn disassociate_localpart_email(&self, localpart: &str) -> Option<Address> {
|
||||
let email = self.get_email_for_localpart(localpart).await?;
|
||||
|
||||
self.db.localpart_email.remove(localpart);
|
||||
self.db
|
||||
.email_localpart
|
||||
.remove(<Address as AsRef<str>>::as_ref(&email));
|
||||
|
||||
Some(email)
|
||||
}
|
||||
|
||||
/// Get the email associated with a localpart, if one exists.
|
||||
|
||||
Reference in New Issue
Block a user