mirror of
https://github.com/matrix-construct/construct
synced 2025-03-13 21:10:32 +01:00
modules/client/login: Support both full mxid and localpart to login.
This commit is contained in:
parent
6bbe8b8855
commit
75a8b2b621
1 changed files with 22 additions and 1 deletions
|
@ -53,10 +53,31 @@ post__login_password(client &client,
|
|||
at<"user"_>(request)
|
||||
};
|
||||
|
||||
const auto &localpart
|
||||
{
|
||||
valid(m::id::USER, username)?
|
||||
m::id::user(username).local():
|
||||
string_view{username}
|
||||
};
|
||||
|
||||
const auto &hostpart
|
||||
{
|
||||
valid(m::id::USER, username)?
|
||||
m::id::user(username).host():
|
||||
my_host()
|
||||
};
|
||||
|
||||
if(!my_host(hostpart))
|
||||
throw m::UNSUPPORTED
|
||||
{
|
||||
"Credentials for users of homeserver '%s' cannot be obtained here.",
|
||||
hostpart,
|
||||
};
|
||||
|
||||
// Build a canonical MXID from a the user field
|
||||
const m::id::user::buf user_id
|
||||
{
|
||||
username, my_host()
|
||||
localpart, hostpart
|
||||
};
|
||||
|
||||
const string_view &supplied_password
|
||||
|
|
Loading…
Add table
Reference in a new issue