Skip to content

Commit

Permalink
Update alist.go
Browse files Browse the repository at this point in the history
  • Loading branch information
Sakura-Byte committed Jan 5, 2025
1 parent 23d9633 commit ff9fde0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions backend/alist/alist.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/rclone/rclone/fs/config"
"github.com/rclone/rclone/fs/config/configmap"
"github.com/rclone/rclone/fs/config/configstruct"
"github.com/rclone/rclone/fs/config/obscure"
"github.com/rclone/rclone/fs/fshttp"
"github.com/rclone/rclone/fs/hash"
"github.com/rclone/rclone/lib/encoder"
Expand Down Expand Up @@ -244,17 +245,20 @@ func (f *Fs) login(ctx context.Context) error {
// Skip login for guest access
return nil
}

pw, err := obscure.Reveal(f.opt.Password)
if err != nil {
return fmt.Errorf("password decode failed - did you obscure it?: %w", err)
}
loginURL := "/api/auth/login/hash"

data := map[string]string{
"username": f.opt.Username,
"password": f.makePasswordHash(f.opt.Password),
"password": pw,
"otpcode": f.opt.OTPCode,
}

var loginResp loginResponse
err := f.makeRequest(ctx, "POST", loginURL, data, &loginResp)
err = f.makeRequest(ctx, "POST", loginURL, data, &loginResp)
if err != nil {
return err
}
Expand Down

0 comments on commit ff9fde0

Please sign in to comment.