mariuszzukowski / Nancy-UserManager

Demo Forms Authentication and User Management

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nancy-UserManager

This is a basic web app I built to get to grips with NancyFx, forms authentication and github.

It's based on the Nancy Forms Authentication Demo solution. I built it as a prototype I could reuse for simple web sites where I needed authentication and user management but didn't need to use a full blown CMS.

It's a work in progress but currently it demonstrates the following:

  1. User authentication with Forms
  2. List all users.
  3. Create user.
  4. Edit User.
  5. Delete User.
  6. Give user a role when creating the user
  7. Change role later
  8. Show a different nav menu based on user role (uses partial views in layout view)

I became fed up with struggling to customise and work with other membership providers and decided to roll my own very simple membership system.

I created a simple users table where passwords are hashed using Bcrypt.Net. Passwords are not stored and cannot be retrieved. Verification works by comparing the password with the hash with Brypt.Net.

It's a Visual Studio 2015 project using:

  • Nancy,
  • Razor,
  • Bootstrap
  • jQuery form plugin.
  • Simple.Data
  • SQL Server

Run the app

  1. Create a new DB in SQL Server.
  2. Run the SQL script in the /scripts folder of the solution into your new DB.
  3. Modify the connection string in web.config to point to your DB.
  4. Build and run.

nb: Nuget packages are not included but should be downloaded when you build the app.

You can log in with one of with the following sets of credentials.

admin@admin.com/admin

viewer@viewer.com/viewer

editor@editor.com/editor

The script contains SQL to create the membership tables, roles and users. To add/edit/delete users log is as admin@admin.com.

About

Demo Forms Authentication and User Management


Languages

Language:C# 99.7%Language:CSS 0.3%