mirror of
https://github.com/rclone/rclone.git
synced 2025-04-19 10:08:56 +08:00
Merge ac2f03c8235cdc1c1f5187aa5eef8179b0bde662 into 0b9671313b14ffe839ecbd7dd2ae5ac7f6f05db8
This commit is contained in:
commit
d79269d7a4
@ -68,6 +68,10 @@ func init() {
|
||||
Help: "Password.",
|
||||
Required: true,
|
||||
IsPassword: true,
|
||||
}, {
|
||||
Name: "mfac",
|
||||
Help: "Multi-factor authentication code.",
|
||||
Required: false,
|
||||
}, {
|
||||
Name: "debug",
|
||||
Help: `Output more debug from Mega.
|
||||
@ -111,6 +115,7 @@ Enabling it will increase CPU usage and add network overhead.`,
|
||||
type Options struct {
|
||||
User string `config:"user"`
|
||||
Pass string `config:"pass"`
|
||||
MFAC string `config:"mfac"`
|
||||
Debug bool `config:"debug"`
|
||||
HardDelete bool `config:"hard_delete"`
|
||||
UseHTTPS bool `config:"use_https"`
|
||||
@ -228,7 +233,14 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||
})
|
||||
}
|
||||
|
||||
err := srv.Login(opt.User, opt.Pass)
|
||||
// Login to mega
|
||||
if opt.MFAC != "" {
|
||||
// Login with MFA if set in the config by the user
|
||||
err = srv.MultiFactorLogin(opt.User, opt.Pass, opt.MFAC)
|
||||
} else {
|
||||
err = srv.Login(opt.User, opt.Pass)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("couldn't login: %w", err)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user