add legacy Element Android/iOS hack for UIAA
legacy element android and ios use the unspecced/invalid "user" field instead of identifier for UIAA. this has broken at least password resets[1] [1]: https://github.com/element-hq/element-android/issues/8043 [2]: https://github.com/element-hq/element-ios/issues/7405 Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
042444dc1d
commit
e9302a9556
@ -149,6 +149,7 @@ impl AuthData {
|
|||||||
identifier: x.identifier.clone(),
|
identifier: x.identifier.clone(),
|
||||||
password: x.password.clone(),
|
password: x.password.clone(),
|
||||||
session: None,
|
session: None,
|
||||||
|
user: None,
|
||||||
})),
|
})),
|
||||||
Self::ReCaptcha(x) => {
|
Self::ReCaptcha(x) => {
|
||||||
Cow::Owned(serialize(ReCaptcha { response: x.response.clone(), session: None }))
|
Cow::Owned(serialize(ReCaptcha { response: x.response.clone(), session: None }))
|
||||||
@ -266,28 +267,36 @@ pub enum AuthType {
|
|||||||
#[serde(tag = "type", rename = "m.login.password")]
|
#[serde(tag = "type", rename = "m.login.password")]
|
||||||
pub struct Password {
|
pub struct Password {
|
||||||
/// One of the user's identifiers.
|
/// One of the user's identifiers.
|
||||||
pub identifier: UserIdentifier,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub identifier: Option<UserIdentifier>,
|
||||||
|
|
||||||
/// The plaintext password.
|
/// The plaintext password.
|
||||||
pub password: String,
|
pub password: String,
|
||||||
|
|
||||||
/// The value of the session key given by the homeserver, if any.
|
/// The value of the session key given by the homeserver, if any.
|
||||||
pub session: Option<String>,
|
pub session: Option<String>,
|
||||||
|
|
||||||
|
/// Username for the user. (Legacy Element Android/iOS hack, do not use!)
|
||||||
|
///
|
||||||
|
/// See <https://github.com/element-hq/element-android/issues/8043>
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub user: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Password {
|
impl Password {
|
||||||
/// Creates a new `Password` with the given identifier and password.
|
/// Creates a new `Password` with the given identifier and password.
|
||||||
pub fn new(identifier: UserIdentifier, password: String) -> Self {
|
pub fn new(identifier: UserIdentifier, password: String) -> Self {
|
||||||
Self { identifier, password, session: None }
|
Self { identifier: Some(identifier), password, session: None, user: None }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for Password {
|
impl fmt::Debug for Password {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let Self { identifier, password: _, session } = self;
|
let Self { identifier, password: _, session, user } = self;
|
||||||
f.debug_struct("Password")
|
f.debug_struct("Password")
|
||||||
.field("identifier", identifier)
|
.field("identifier", identifier)
|
||||||
.field("session", session)
|
.field("session", session)
|
||||||
|
.field("user", user)
|
||||||
.finish_non_exhaustive()
|
.finish_non_exhaustive()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user