2018-02-14 21:54:21 +01:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
|
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice is present in all copies. The
|
|
|
|
// full license for this software is available in the LICENSE file.
|
|
|
|
|
|
|
|
#include "account.h"
|
|
|
|
|
|
|
|
using namespace ircd;
|
|
|
|
|
2019-09-29 01:12:07 +02:00
|
|
|
m::resource
|
2018-02-14 21:54:21 +01:00
|
|
|
account_deactivate
|
|
|
|
{
|
|
|
|
"/_matrix/client/r0/account/deactivate",
|
|
|
|
{
|
|
|
|
"Deactivate the user's account, removing all ability for the user to login again. (3.3.3)"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-09-29 01:12:07 +02:00
|
|
|
m::resource::response
|
2018-02-14 21:54:21 +01:00
|
|
|
post__deactivate(client &client,
|
2019-09-29 01:12:07 +02:00
|
|
|
const m::resource::request &request)
|
2018-02-14 21:54:21 +01:00
|
|
|
{
|
2019-07-04 00:24:20 +02:00
|
|
|
const json::object &auth
|
2018-02-14 21:54:21 +01:00
|
|
|
{
|
2019-07-04 00:24:20 +02:00
|
|
|
request["auth"]
|
2018-02-14 21:54:21 +01:00
|
|
|
};
|
|
|
|
|
2019-07-04 00:24:20 +02:00
|
|
|
const json::string &type
|
2018-02-14 21:54:21 +01:00
|
|
|
{
|
2019-07-04 00:24:20 +02:00
|
|
|
auth.at("type")
|
|
|
|
};
|
|
|
|
|
|
|
|
const json::string &session
|
|
|
|
{
|
|
|
|
auth["session"]
|
2018-02-14 21:54:21 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
m::user user
|
|
|
|
{
|
|
|
|
request.user_id
|
|
|
|
};
|
|
|
|
|
|
|
|
user.deactivate();
|
|
|
|
|
2019-09-29 01:12:07 +02:00
|
|
|
return m::resource::response
|
2018-02-14 21:54:21 +01:00
|
|
|
{
|
|
|
|
client, json::members
|
|
|
|
{
|
|
|
|
{ "goodbye", "Thanks for giving us a try. Sorry it didn't work out." }
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-09-29 01:12:07 +02:00
|
|
|
m::resource::method
|
2018-02-14 21:54:21 +01:00
|
|
|
post_deactivate
|
|
|
|
{
|
|
|
|
account_deactivate, "POST", post__deactivate,
|
|
|
|
{
|
|
|
|
post_deactivate.REQUIRES_AUTH
|
|
|
|
}
|
|
|
|
};
|