mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 11:20:18 +08:00
feat: return most backend API errors to frontend (#1836)
* feat: return most backend API errros to frontend Signed-off-by: yehong <239859435@qq.com> * refactor: reduce int type change Signed-off-by: yehong <239859435@qq.com> * feat: return err backend in token.go Signed-off-by: yehong <239859435@qq.com> --------- Signed-off-by: yehong <239859435@qq.com>
This commit is contained in:
@ -16,18 +16,27 @@ package object
|
||||
|
||||
import "github.com/casdoor/casdoor/cred"
|
||||
|
||||
func calculateHash(user *User) string {
|
||||
syncer := getDbSyncerForUser(user)
|
||||
if syncer == nil {
|
||||
return ""
|
||||
func calculateHash(user *User) (string, error) {
|
||||
syncer, err := getDbSyncerForUser(user)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return syncer.calculateHash(user)
|
||||
if syncer == nil {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
return syncer.calculateHash(user), nil
|
||||
}
|
||||
|
||||
func (user *User) UpdateUserHash() {
|
||||
hash := calculateHash(user)
|
||||
func (user *User) UpdateUserHash() error {
|
||||
hash, err := calculateHash(user)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
user.Hash = hash
|
||||
return nil
|
||||
}
|
||||
|
||||
func (user *User) UpdateUserPassword(organization *Organization) {
|
||||
|
Reference in New Issue
Block a user