mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[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
This commit is contained in:
@@ -17,6 +17,51 @@
|
||||
|
||||
package model
|
||||
|
||||
// User models fields relevant to one user.
|
||||
//
|
||||
// swagger:model user
|
||||
type User struct {
|
||||
// Database ID of this user.
|
||||
// example: 01FBVD42CQ3ZEEVMW180SBX03B
|
||||
ID string `json:"id"`
|
||||
// Time this user was created. (ISO 8601 Datetime)
|
||||
// example: 2021-07-30T09:20:25+00:00
|
||||
CreatedAt string `json:"created_at"`
|
||||
// Confirmed email address of this user, if set.
|
||||
// example: someone@example.org
|
||||
Email string `json:"email,omitempty"`
|
||||
// Unconfirmed email address of this user, if set.
|
||||
// example: someone.else@somewhere.else.example.org
|
||||
UnconfirmedEmail string `json:"unconfirmed_email,omitempty"`
|
||||
// Reason for sign-up, if provided.
|
||||
// example: Please! Pretty please!
|
||||
Reason string `json:"reason,omitempty"`
|
||||
// Time at which this user was last emailed, if at all. (ISO 8601 Datetime)
|
||||
// example: 2021-07-30T09:20:25+00:00
|
||||
LastEmailedAt string `json:"last_emailed_at,omitempty"`
|
||||
// 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
|
||||
ConfirmedAt string `json:"confirmed_at,omitempty"`
|
||||
// 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
|
||||
ConfirmationSentAt string `json:"confirmation_sent_at,omitempty"`
|
||||
// User is a moderator.
|
||||
// example: false
|
||||
Moderator bool `json:"moderator"`
|
||||
// User is an admin.
|
||||
// example: false
|
||||
Admin bool `json:"admin"`
|
||||
// User's account is disabled.
|
||||
// example: false
|
||||
Disabled bool `json:"disabled"`
|
||||
// User was approved by an admin.
|
||||
// example: true
|
||||
Approved bool `json:"approved"`
|
||||
// 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
|
||||
ResetPasswordSentAt string `json:"reset_password_sent_at,omitempty"`
|
||||
}
|
||||
|
||||
// PasswordChangeRequest models user password change parameters.
|
||||
//
|
||||
// swagger:parameters userPasswordChange
|
||||
@@ -34,3 +79,19 @@ type PasswordChangeRequest struct {
|
||||
// required: true
|
||||
NewPassword string `form:"new_password" json:"new_password" xml:"new_password" validation:"required"`
|
||||
}
|
||||
|
||||
// EmailChangeRequest models user email change parameters.
|
||||
//
|
||||
// swagger:parameters userEmailChange
|
||||
type EmailChangeRequest struct {
|
||||
// User's current password, for verification.
|
||||
//
|
||||
// in: formData
|
||||
// required: true
|
||||
Password string `form:"password" json:"password" xml:"password" validation:"required"`
|
||||
// Desired new email address.
|
||||
//
|
||||
// in: formData
|
||||
// required: true
|
||||
NewEmail string `form:"new_email" json:"new_email" xml:"new_email" validation:"required"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user