An ASP.NET MVC project with RavenDB backend, using SendGrid and Twilio for user registration confirmation and optional two-factor authentication.
C# JavaScript Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

RavenDB Modern MVC Starter Kit

An MVC sample project that uses RavenDB as the backend, supports user registration and confirmation via email (SendGrid), and optionally supports Two-Factor Authentication via email (SendGrid) or SMS (Twilio).

This project provides:

  • A RavenDB-backed identity provider, updated to work with the latest MS Identity Framework (2.1 at the time of this writing).
  • A registration confirmation system: when a user registers, he is required to confirm his registration via email. The email is sent via your developer SendGrid account. Upon registering, the user is presented with the following screen:

The user will receive an email with a confirmation link. Following the link, he'll be taken to this page:

- Optional two-factor authentication: Users can optionally go to their profile page and add a phone number and enable Two-Factor Authentication:

When the user enters his phone number, we send an SMS verification code via your developer Twilio account:

With Two-Factor Authentication enabled, when the user goes to sign-in next time, he will first login as usual, and then be prompted to enter the 2nd form of identification, either email or SMS:

The user will receive a verfication code via SMS or email and be redirected to the verification page:

Upon entering the verification code, they'll be able to sign in.

#To run this sample:

  1. Run a RavenDB server locally on the default port (8080). Alternately, change the RavenDB connection string in web.config to point it to a database somewhere else.
  2. Get a SendGrid account. Sign up here for a free 200 emails/day account.
  3. Get a Twilio account. Sign up here for a free account.
  4. Create an empty file in the RavenDB.ModernMvcStarterKit\RavenStarterKit directory, name it AppSettingsSecrets.config.ignore
  5. Put your Twilio and SendGrid credentials in AppSettingsSecrets.config.ignore, so that it looks like this:
      <!-- SendGrid--> 
      <add key="mailAccount" value="SendGrid account ID" />
      <add key="mailPassword" value="SendGrid password" />
      <!-- Twilio--> 
      <add key="TwilioSid" value="Twilio SID" />
      <add key="TwilioToken" value="Twilio secret token" />
      <add key="TwilioFromPhone" value="Twilio number here, e.g. +13334444333" /> 

That's it! You now have an MVC site with RavenDB, user registrations with email confirmation, plus optional Two-Factor Authentication.

Have fun!

Questions? I'm @judahgabriel on Twitter.