-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(patch): turn two functions into patches
- Loading branch information
Showing
6 changed files
with
94 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package v3_24_0 | ||
|
||
import ( | ||
"github.com/alist-org/alist/v3/internal/db" | ||
"github.com/alist-org/alist/v3/internal/op" | ||
"github.com/alist-org/alist/v3/pkg/utils" | ||
) | ||
|
||
// HashPwdForOldVersion encode passwords using SHA256 | ||
// First published: 75acbcc perf: sha256 for user's password (close #3552) by Andy Hsu | ||
func HashPwdForOldVersion() { | ||
users, _, err := op.GetUsers(1, -1) | ||
if err != nil { | ||
utils.Log.Fatalf("[hash pwd for old version] failed get users: %v", err) | ||
} | ||
for i := range users { | ||
user := users[i] | ||
if user.PwdHash == "" { | ||
user.SetPassword(user.Password) | ||
user.Password = "" | ||
if err := db.UpdateUser(&user); err != nil { | ||
utils.Log.Fatalf("[hash pwd for old version] failed update user: %v", err) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package v3_32_0 | ||
|
||
import ( | ||
"github.com/alist-org/alist/v3/internal/db" | ||
"github.com/alist-org/alist/v3/internal/op" | ||
"github.com/alist-org/alist/v3/pkg/utils" | ||
) | ||
|
||
// UpdateAuthnForOldVersion updates users' authn | ||
// First published: bdfc159 fix: webauthn logspam (#6181) by itsHenry | ||
func UpdateAuthnForOldVersion() { | ||
users, _, err := op.GetUsers(1, -1) | ||
if err != nil { | ||
utils.Log.Fatalf("[update authn for old version] failed get users: %v", err) | ||
} | ||
for i := range users { | ||
user := users[i] | ||
if user.Authn == "" { | ||
user.Authn = "[]" | ||
if err := db.UpdateUser(&user); err != nil { | ||
utils.Log.Fatalf("[update authn for old version] failed update user: %v", err) | ||
} | ||
} | ||
} | ||
} |