Skip to content

Commit

Permalink
Remove username AKA from settings POST (#72)
Browse files Browse the repository at this point in the history
* remove username aka from settings POST

* remove username aka from `UsersSelfSettingsGET`
  • Loading branch information
lenforiee authored Sep 11, 2024
1 parent be75a77 commit 9cb9e80
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions app/v1/self.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func UsersSelfFavouriteModeGET(md common.MethodData) common.CodeMessager {
}

type userSettingsData struct {
UsernameAKA *string `json:"username_aka"`
FavouriteMode *int `json:"favourite_mode"`
CustomBadge struct {
singleBadge
Expand All @@ -67,11 +66,6 @@ func UsersSelfSettingsPOST(md common.MethodData) common.CodeMessager {
var d userSettingsData
md.Unmarshal(&d)

aka := strings.TrimSpace(*d.UsernameAKA)
if aka == "" {
*d.UsernameAKA = ""
}

// input sanitisation
if md.User.UserPrivileges&common.UserPrivilegeDonor > 0 {
d.CustomBadge.Name = common.SanitiseString(d.CustomBadge.Name)
Expand All @@ -83,7 +77,6 @@ func UsersSelfSettingsPOST(md common.MethodData) common.CodeMessager {
d.FavouriteMode = intPtrIn(0, d.FavouriteMode, 3)

q := new(common.UpdateQuery).
Add("username_aka", d.UsernameAKA).
Add("favourite_mode", d.FavouriteMode).
Add("custom_badge_name", d.CustomBadge.Name).
Add("custom_badge_icon", d.CustomBadge.Icon).
Expand Down Expand Up @@ -115,15 +108,15 @@ func UsersSelfSettingsGET(md common.MethodData) common.CodeMessager {
err := md.DB.QueryRow(`
SELECT
id, username,
email, username_aka, favourite_mode,
email, favourite_mode,
show_custom_badge, custom_badge_icon,
custom_badge_name, can_custom_badge,
play_style, vanilla_pp_leaderboards,
leaderboard_size
FROM users
WHERE id = ?`, md.ID()).Scan(
&r.ID, &r.Username,
&r.Email, &r.UsernameAKA, &r.FavouriteMode,
&r.Email, &r.FavouriteMode,
&r.CustomBadge.Show, &r.CustomBadge.Icon,
&r.CustomBadge.Name, &ccb,
&r.PlayStyle, &r.VanillaPPLeaderboards,
Expand Down

0 comments on commit 9cb9e80

Please sign in to comment.