add password reset link option
When enabled (in Settings > Password Resets), a magic link will be sent instead of a PIN when the user tries reset their password. By doing this the user doesn't have to keep the Jellyfin tab open to enter the code.
This commit is contained in:
@@ -94,6 +94,30 @@ func (app *appContext) AdminPage(gc *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
func (app *appContext) ResetPassword(gc *gin.Context) {
|
||||
pin := gc.Query("pin")
|
||||
if pin == "" {
|
||||
app.NoRouteHandler(gc)
|
||||
return
|
||||
}
|
||||
app.pushResources(gc, false)
|
||||
lang := app.getLang(gc, app.storage.lang.chosenPWRLang)
|
||||
data := gin.H{
|
||||
"urlBase": app.getURLBase(gc),
|
||||
"contactMessage": app.config.Section("ui").Key("contact_message").String(),
|
||||
"strings": app.storage.lang.PasswordReset[lang].Strings,
|
||||
"success": false,
|
||||
}
|
||||
resp, status, err := app.jf.ResetPassword(pin)
|
||||
if status == 200 && err == nil && resp.Success {
|
||||
data["success"] = true
|
||||
data["pin"] = pin
|
||||
} else {
|
||||
app.err.Printf("Password Reset failed (%d): %v", status, err)
|
||||
}
|
||||
gcHTML(gc, http.StatusOK, "password-reset.html", data)
|
||||
}
|
||||
|
||||
func (app *appContext) InviteProxy(gc *gin.Context) {
|
||||
app.pushResources(gc, false)
|
||||
code := gc.Param("invCode")
|
||||
|
||||
Reference in New Issue
Block a user