mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-21 23:20:24 +00:00
dataprovider: simplifly validateUser
This commit is contained in:
parent
00dd5db226
commit
0b4ff97a1a
1 changed files with 5 additions and 1 deletions
|
@ -266,12 +266,16 @@ func Close(p Provider) error {
|
|||
return p.close()
|
||||
}
|
||||
|
||||
func validateUser(user *User) error {
|
||||
func buildUserHomeDir(user *User) {
|
||||
if len(user.HomeDir) == 0 {
|
||||
if len(config.UsersBaseDir) > 0 {
|
||||
user.HomeDir = filepath.Join(config.UsersBaseDir, user.Username)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func validateUser(user *User) error {
|
||||
buildUserHomeDir(user)
|
||||
if len(user.Username) == 0 || len(user.HomeDir) == 0 {
|
||||
return &ValidationError{err: "Mandatory parameters missing"}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue