Fix issue in mongodb connection
This commit is contained in:
parent
c96b6ed943
commit
f5bb2e7c2c
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue