Update README.md

This commit is contained in:
Alexandre SPIESER
2017-10-22 00:59:42 +01:00
committed by GitHub
parent 0ebee24219
commit 5ed5778e4f
+2 -2
View File
@@ -33,7 +33,7 @@ Here is an example:
} }
} }
``` ```
The Id field is automatically set at instanciation, this also applies to users inheriting from MongoIdentityUser<int>, where a random integer is assigned to the Id. It is however not advised to rely on such random mechanism to set the primary key of your document. Using documents inheriting from `MongoIdentityRole<Guid>` is recommended. The `Id` field is automatically set at instanciation, this also applies to users inheriting from `MongoIdentityUser<int>`, where a random integer is assigned to the `Id`. It is however not advised to rely on such random mechanism to set the primary key of your document. Using documents inheriting from `MongoIdentityRole<Guid>` is recommended.
The configuration is done by populating a `MongoDbIdentityConfiguration` object, which can have an `IdentityOptionsAction` property set to an action you want to perform against the `IdentityOptions` (`Action<IdentityOptions>`). The configuration is done by populating a `MongoDbIdentityConfiguration` object, which can have an `IdentityOptionsAction` property set to an action you want to perform against the `IdentityOptions` (`Action<IdentityOptions>`).
@@ -60,6 +60,7 @@ The MongoDb connection is managed using the [mongodb-generic-repository](https:/
// add a global config object // add a global config object
services.AddSingleton(Configuration); services.AddSingleton(Configuration);
// get the MongoDb settings from the Configuration object.
var settings = Configuration.GetSection(nameof(MongoDbSettings)).Get<MongoDbSettings>(); var settings = Configuration.GetSection(nameof(MongoDbSettings)).Get<MongoDbSettings>();
var mongoDbIdentityConfiguration = new MongoDbIdentityConfiguration var mongoDbIdentityConfiguration = new MongoDbIdentityConfiguration
{ {
@@ -76,7 +77,6 @@ The MongoDb connection is managed using the [mongodb-generic-repository](https:/
options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(30); options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(30);
options.Lockout.MaxFailedAccessAttempts = 10; options.Lockout.MaxFailedAccessAttempts = 10;
// ApplicationUser settings // ApplicationUser settings
options.User.RequireUniqueEmail = true; options.User.RequireUniqueEmail = true;
options.User.AllowedUserNameCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@.-_"; options.User.AllowedUserNameCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@.-_";