From: Maxim Filippov Date: Tue, 24 Sep 2019 10:00:48 +0000 (+0300) Subject: Merge branch 'develop' into feature/return-link-for-password-reset X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=5e9759cd7d0730c14bcc44e9b3dbda94947d602f;p=akkoma Merge branch 'develop' into feature/return-link-for-password-reset --- 5e9759cd7d0730c14bcc44e9b3dbda94947d602f diff --cc CHANGELOG.md index e816e1394,649fbc0be..58bb7abc2 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@@ -12,7 -14,8 +14,9 @@@ The format is based on [Keep a Changelo - Introduced [quantum](https://github.com/quantum-elixir/quantum-core) job scheduler - Admin API: Return `total` when querying for reports - Mastodon API: Return `pleroma.direct_conversation_id` when creating a direct message (`POST /api/v1/statuses`) +- Admin API: Return link alongside with token on password reset + ### Fixed + - Mastodon API: Fix private and direct statuses not being filtered out from the public timeline for an authenticated user (`GET /api/v1/timelines/public`) ## [1.1.0] - 2019-??-?? ### Security diff --cc docs/api/admin_api.md index bc45871a3,9583883d3..d4e08f221 --- a/docs/api/admin_api.md +++ b/docs/api/admin_api.md @@@ -308,16 -308,16 +308,24 @@@ Note: Available `:permission_group` is - Methods: `GET` - Params: none -- Response: password reset token (base64 string) +- Response: + +```json +{ + "token": "U13DX6muOvpRsj35_ij9wLxUbkU-eFvfKttxs6gIajo=", // password reset token (base64 string) + "link": "https://pleroma.social/api/pleroma/password_reset/U13DX6muOvpRsj35_ij9wLxUbkU-eFvfKttxs6gIajo%3D" +} +``` + + ## `/api/pleroma/admin/users/:nickname/force_password_reset` + + ### Force passord reset for a user with a given nickname + + - Methods: `PATCH` + - Params: none + - Response: none (code `204`) + ## `/api/pleroma/admin/reports` ### Get a list of reports - Method `GET` diff --cc lib/pleroma/web/admin_api/admin_api_controller.ex index 460188390,0d1db8fa0..6b6d124a5 --- a/lib/pleroma/web/admin_api/admin_api_controller.ex +++ b/lib/pleroma/web/admin_api/admin_api_controller.ex @@@ -446,12 -450,18 +452,21 @@@ defmodule Pleroma.Web.AdminAPI.AdminAPI {:ok, token} = Pleroma.PasswordResetToken.create_token(user) conn - |> json(token.token) + |> json(%{ + token: token.token, + link: Router.Helpers.reset_password_url(Endpoint, :reset, token.token) + }) end + @doc "Force password reset for a given user" + def force_password_reset(conn, %{"nickname" => nickname}) do + (%User{local: true} = user) = User.get_cached_by_nickname(nickname) + + User.force_password_reset_async(user) + + json_response(conn, :no_content, "") + end + def list_reports(conn, params) do params = params