support for users without a password to change their password

This commit is contained in:
MaysWind
2025-10-22 00:15:39 +08:00
parent a42c5fa988
commit 6395e3b5c1
5 changed files with 12 additions and 9 deletions
+2
View File
@@ -225,6 +225,7 @@ type UserProfileUpdateResponse struct {
// UserProfileResponse represents a view-object of user profile
type UserProfileResponse struct {
*UserBasicInfo
NoPassword bool `json:"noPassword,omitempty"`
LastLoginAt int64 `json:"lastLoginAt"`
}
@@ -313,6 +314,7 @@ func (u *User) ToUserBasicInfo(avatarProvider core.UserAvatarProviderType, avata
func (u *User) ToUserProfileResponse(basicInfo *UserBasicInfo) *UserProfileResponse {
return &UserProfileResponse{
UserBasicInfo: basicInfo,
NoPassword: u.Password == "",
LastLoginAt: u.LastLoginUnixTime,
}
}