mirror of
https://github.com/rclone/rclone.git
synced 2024-11-21 16:03:29 +01:00
Added initial support for Mega MFA
This commit is contained in:
parent
97276ce765
commit
ac2f03c823
@ -66,6 +66,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.
|
||||
@ -109,6 +113,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"`
|
||||
@ -226,7 +231,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…
Reference in New Issue
Block a user