From bcda048eab799284fc46d74706334bf9ef76dc83 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Thu, 6 Jun 2024 15:43:25 +0200 Subject: [feature] Self-serve email change for users (#2957) * [feature] Email change * frontend stuff for changing email * docs * tests etc * differentiate more clearly between local user+account and account * populate user --- docs/api/swagger.yaml | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) (limited to 'docs/api') diff --git a/docs/api/swagger.yaml b/docs/api/swagger.yaml index 5d93b33b1..55e88b62c 100644 --- a/docs/api/swagger.yaml +++ b/docs/api/swagger.yaml @@ -2713,6 +2713,77 @@ definitions: type: object x-go-name: Theme x-go-package: github.com/superseriousbusiness/gotosocial/internal/api/model + user: + properties: + admin: + description: User is an admin. + example: false + type: boolean + x-go-name: Admin + approved: + description: User was approved by an admin. + example: true + type: boolean + x-go-name: Approved + confirmation_sent_at: + description: Time when the last "please confirm your email address" email was sent, if at all. (ISO 8601 Datetime) + example: "2021-07-30T09:20:25+00:00" + type: string + x-go-name: ConfirmationSentAt + confirmed_at: + description: Time at which the email given in the `email` field was confirmed, if at all. (ISO 8601 Datetime) + example: "2021-07-30T09:20:25+00:00" + type: string + x-go-name: ConfirmedAt + created_at: + description: Time this user was created. (ISO 8601 Datetime) + example: "2021-07-30T09:20:25+00:00" + type: string + x-go-name: CreatedAt + disabled: + description: User's account is disabled. + example: false + type: boolean + x-go-name: Disabled + email: + description: Confirmed email address of this user, if set. + example: someone@example.org + type: string + x-go-name: Email + id: + description: Database ID of this user. + example: 01FBVD42CQ3ZEEVMW180SBX03B + type: string + x-go-name: ID + last_emailed_at: + description: Time at which this user was last emailed, if at all. (ISO 8601 Datetime) + example: "2021-07-30T09:20:25+00:00" + type: string + x-go-name: LastEmailedAt + moderator: + description: User is a moderator. + example: false + type: boolean + x-go-name: Moderator + reason: + description: Reason for sign-up, if provided. + example: Please! Pretty please! + type: string + x-go-name: Reason + reset_password_sent_at: + description: Time when the last "please reset your password" email was sent, if at all. (ISO 8601 Datetime) + example: "2021-07-30T09:20:25+00:00" + type: string + x-go-name: ResetPasswordSentAt + unconfirmed_email: + description: Unconfirmed email address of this user, if set. + example: someone.else@somewhere.else.example.org + type: string + x-go-name: UnconfirmedEmail + title: User models fields relevant to one user. + type: object + x-go-name: User + x-go-package: github.com/superseriousbusiness/gotosocial/internal/api/model wellKnownResponse: description: See https://webfinger.net/ properties: @@ -8636,6 +8707,77 @@ paths: summary: See public statuses that use the given hashtag (case insensitive). tags: - timelines + /api/v1/user: + get: + operationId: getUser + produces: + - application/json + responses: + "200": + description: The requested user. + schema: + $ref: '#/definitions/user' + "400": + description: bad request + "401": + description: unauthorized + "403": + description: forbidden + "406": + description: not acceptable + "500": + description: internal error + security: + - OAuth2 Bearer: + - read:user + summary: Get your own user model. + tags: + - user + /api/v1/user/email_change: + post: + consumes: + - application/json + - application/xml + - application/x-www-form-urlencoded + operationId: userEmailChange + parameters: + - description: User's current password, for verification. + in: formData + name: password + required: true + type: string + x-go-name: Password + - description: Desired new email address. + in: formData + name: new_email + required: true + type: string + x-go-name: NewEmail + produces: + - application/json + responses: + "202": + description: 'Accepted: email change is processing; check your inbox to confirm new address.' + schema: + $ref: '#/definitions/user' + "400": + description: bad request + "401": + description: unauthorized + "403": + description: forbidden + "406": + description: not acceptable + "409": + description: 'Conflict: desired email address already in use' + "500": + description: internal error + security: + - OAuth2 Bearer: + - write:user + summary: Request changing the email address of authenticated user. + tags: + - user /api/v1/user/password_change: post: consumes: -- cgit v1.2.3