Fix issue in mongodb connection

This commit is contained in:
Arnaud Delcasse 2023-04-30 13:53:20 +02:00
parent c96b6ed943
commit f5bb2e7c2c
1 changed files with 3 additions and 4 deletions

View File

@ -27,7 +27,7 @@ func NewMongoDBStorage(cfg *viper.Viper) (MongoDBStorage, error) {
)
if mongodb_uri == "" {
mongodb_uri = fmt.Sprintf("mongodb://%s:%s/%s", mongodb_host, mongodb_port, mongodb_dbname)
mongodb_uri = fmt.Sprintf("mongodb://%s:%s", mongodb_host, mongodb_port)
}
client, err := mongo.NewClient(options.Client().ApplyURI(mongodb_uri))
@ -82,10 +82,9 @@ func (s MongoDBStorage) LocalAuthentication(namespace string, username string, e
if err := collection.FindOne(context.TODO(), bson.M{"namespace": namespace, "authentication.local.phone_number": phone_number}).Decode(account); err != nil {
return nil, err
}
} else {
return nil, errors.New("missing username, email or password")
}
// else {
// return nil, errors.New("missing username, email or password")
// }
return account, nil
}