diff --git a/api-userpage.go b/api-userpage.go index 3097b5e..f129a08 100644 --- a/api-userpage.go +++ b/api-userpage.go @@ -478,7 +478,7 @@ func (app *appContext) UnlinkMyMatrix(gc *gin.Context) { respondBool(200, true, gc) } -// @Summary Generate & send a password reset link if the given email/contact method exists. Doesn't give you any info about it's success. +// @Summary Generate & send a password reset link if the given username/email/contact method exists. Doesn't give you any info about it's success. // @Produce json // @Param address path string true "address/contact method associated w/ your account." // @Success 204 {object} boolResponse @@ -502,7 +502,7 @@ func (app *appContext) ResetMyPassword(gc *gin.Context) { var pwr InternalPWR var err error - jfID := app.reverseUserSearch(address) + jfID := app.ReverseUserSearch(address) if jfID == "" { app.debug.Printf("Ignoring PWR request: User not found") diff --git a/config/config-base.json b/config/config-base.json index c0fb5f8..c8e08af 100644 --- a/config/config-base.json +++ b/config/config-base.json @@ -377,7 +377,7 @@ "order": [], "meta": { "name": "User Page", - "description": "Settings for the user page, which provides useful info and tools to users directly.", + "description": "The User Page (My Account) allows users to access and modify info directly, such as changing/adding contact methods, seeing their expiry date, or changing their password. Password resets can also be initiated from here, given a contact method or username. ", "depends_true": "ui|jellyfin_login" }, "settings": { diff --git a/email.go b/email.go index dda9428..4ee8f36 100644 --- a/email.go +++ b/email.go @@ -872,7 +872,13 @@ func (app *appContext) getAddressOrName(jfID string) string { return "" } -func (app *appContext) reverseUserSearch(address string) string { +// ReverseUserSearch returns the jellyfin ID of the user with the given username, email, or contact method username. +// returns "" if none found. returns only the first match, might be an issue if there are users with the same contact method usernames. +func (app *appContext) ReverseUserSearch(address string) string { + user, status, err := app.jf.UserByName(address, false) + if status == 200 && err == nil { + return user.ID + } for id, email := range app.storage.GetEmails() { if strings.ToLower(address) == strings.ToLower(email.Addr) { return id diff --git a/html/user.html b/html/user.html index b709969..2c5cf5d 100644 --- a/html/user.html +++ b/html/user.html @@ -56,7 +56,7 @@ {{ end }}