Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from troygoode:master #1

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# ASP.NET MVC Membership Starter Kit

**[Follow me (@troygoode) on Twitter!](https://twitter.com/intent/user?screen_name=troygoode)**

# What is the Asp.Net MVC Membership Starter Kit?

The starter kit currently consists of two things:
Expand All @@ -13,7 +17,7 @@ Out of the box, the starter kit gives you the following features:
* Change Email Address
* Change a User's Roles

Some screenshots of the UI are [available on my blog](http://www.squaredroot.com/2009/08/07/mvcmembership-release-1-0/). While that blog post announced an older version of the project, the screenshots still accurately reflect the current version.
[Tips are welcome, but not expected.](https://www.gittip.com/TroyGoode/)

# How do I use it?

Expand Down Expand Up @@ -43,22 +47,24 @@ instructions:
3. Configure the `system.net/mailSettings/smtp` node in your web.config file with the appropriate SMTP settings so that emails can be sent for password change/reset events.
4. Make sure the user identity of your application pool has sufficient permissions to the aspnet database.
5. Add the following code to your `global.asax` to keep the membership system updated with each user's last activity date:
<pre>
protected void Application_AuthenticateRequest()
{
if(HttpContext.Current.User != null)
Membership.GetUser(true);
}
</pre>

```csharp
protected void Application_AuthenticateRequest()
{
if(HttpContext.Current.User != null)
Membership.GetUser(true);
}
```

## Integrate the Views

1. The starter kit relies on your site having a site master page. A default ASP.Net MVC site is generated with a `Site.Master` in the `\Views\Shared` folder. If you want to isolate something to the starter kit you could put it in `\Areas\UserAdministration\Views\Shared`.
2. That master page and any contained views will need to specify their Area when generating links, even views not in an area (so the default master page would requires fixes). If the link is not to a page in an area (typical), then an Area of "" (empty string) should be specified. For instance, a call to generate a link to the homepage should look like so:
`Html.ActionLink("Home", "Index", "Home", new {Area = ""}, new {})`
3. Add a User Administration link to your master page (change "Administrator" to whatever role you want to use):
<pre>
&lt;% if (Roles.IsUserInRole("Administrator")){ %&gt;
&lt;li&gt;&lt;%= Html.ActionLink("User Administration", "Index", "UserAdministration", new { Area = "UserAdministration" }, new { })%&gt;&lt;/li&gt;
&lt;% } %&gt;
</pre>

```erb
<% if (Roles.IsUserInRole("Administrator")){ %>
<li><%= Html.ActionLink("User Administration", "Index", "UserAdministration", new { Area = "UserAdministration" }, new { }) %></li>
<% } %>
```
42 changes: 21 additions & 21 deletions packages/MvcMembership.Mvc/MvcMembership.Mvc.nuspec
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata schemaVersion="2">
<id>MvcMembership.Mvc</id>
<version>3.4.0.0</version>
<authors>Troy Goode</authors>
<owners>TroyGoode</owners>
<description><![CDATA[The starter kit provides the Asp.Net MVC controllers, models, and views needed to administer users & roles.]]></description>
<tags>membership users administration mvc</tags>
<language>en-US</language>
<projectUrl>http://github.com/TroyGoode/MembershipStarterKit</projectUrl>
<licenseUrl>http://www.opensource.org/licenses/mit-license.php</licenseUrl>
<dependencies>
<dependency id="PagedList" version="1.10" />
<dependency id="PagedList.Mvc" version="3.9" />
<dependency id="MvcMembership" version="3.4" />
<dependency id="DataAnnotationsExtensions.MVC3" version="0.6" />
<dependency id="WebActivator" version="1.4.1" />
</dependencies>
<releaseNotes>Fixed security vulenerability and a couple small bugs.</releaseNotes>
</metadata>
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata schemaVersion="2">
<id>MvcMembership.Mvc</id>
<version>3.8.0</version>
<authors>Troy Goode</authors>
<owners>TroyGoode</owners>
<description><![CDATA[The starter kit provides the Asp.Net MVC controllers, models, and views needed to administer users & roles.]]></description>
<tags>membership users administration mvc</tags>
<language>en-US</language>
<projectUrl>http://github.com/TroyGoode/MembershipStarterKit</projectUrl>
<licenseUrl>http://www.opensource.org/licenses/mit-license.php</licenseUrl>
<dependencies>
<dependency id="PagedList" version="1.15" />
<dependency id="PagedList.Mvc" version="3.18" />
<dependency id="MvcMembership" version="3.8.0" />
<dependency id="DataAnnotationsExtensions.MVC3" version="0.6" />
<dependency id="WebActivator" version="1.4.1" />
</dependencies>
<releaseNotes>Fixed security vulenerability and a couple small bugs.</releaseNotes>
</metadata>
</package>
34 changes: 17 additions & 17 deletions packages/MvcMembership/MvcMembership.nuspec
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata schemaVersion="2">
<id>MvcMembership</id>
<version>3.4.0.0</version>
<authors>Troy Goode</authors>
<owners>TroyGoode</owners>
<description><![CDATA[The starter kit provides the Asp.Net MVC controllers, models, and views needed to administer users & roles. This package contains classes needed by the MvcMembership.Mvc package to provide a testable interface to ASP.Net's MembershipProvider and RoleProvider features.]]></description>
<tags>membership users administration mvc</tags>
<language>en-US</language>
<projectUrl>http://github.com/TroyGoode/MembershipStarterKit</projectUrl>
<licenseUrl>http://www.opensource.org/licenses/mit-license.php</licenseUrl>
<dependencies>
<dependency id="PagedList" version="1.10" />
</dependencies>
<releaseNotes>Fixed security vulenerability and a couple small bugs.</releaseNotes>
</metadata>
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata schemaVersion="2">
<id>MvcMembership</id>
<version>3.8.0</version>
<authors>Troy Goode</authors>
<owners>TroyGoode</owners>
<description><![CDATA[The starter kit provides the Asp.Net MVC controllers, models, and views needed to administer users & roles. This package contains classes needed by the MvcMembership.Mvc package to provide a testable interface to ASP.Net's MembershipProvider and RoleProvider features.]]></description>
<tags>membership users administration mvc</tags>
<language>en-US</language>
<projectUrl>http://github.com/TroyGoode/MembershipStarterKit</projectUrl>
<licenseUrl>http://www.opensource.org/licenses/mit-license.php</licenseUrl>
<dependencies>
<dependency id="PagedList" version="1.15" />
</dependencies>
<releaseNotes>Fixed security vulenerability and a couple small bugs.</releaseNotes>
</metadata>
</package>
47 changes: 47 additions & 0 deletions src/Backup/MvcMembership.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3BC95434-BABE-4954-9DE3-B88B7A5EE2DB}"
ProjectSection(SolutionItems) = preProject
..\LICENSE.txt = ..\LICENSE.txt
..\packages\MvcMembership.Mvc\MvcMembership.Mvc.nuspec = ..\packages\MvcMembership.Mvc\MvcMembership.Mvc.nuspec
..\packages\MvcMembership\MvcMembership.nuspec = ..\packages\MvcMembership\MvcMembership.nuspec
..\rakefile.rb = ..\rakefile.rb
..\README.markdown = ..\README.markdown
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvcMembership", "MvcMembership\MvcMembership.csproj", "{C9D7F653-E589-44CE-9D41-89821F4F9E4E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvcMembership.Tests", "MvcMembership.Tests\MvcMembership.Tests.csproj", "{B48B10DD-E450-49AF-A1FA-102AC165DEEA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleWebsite.Mvc3", "SampleWebsite.Mvc3\SampleWebsite.Mvc3.csproj", "{65C3A21B-D946-45B6-8A7E-2DBB98E35E0C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleWebsite.Mvc3.Tests", "SampleWebsite.Mvc3.Tests\SampleWebsite.Mvc3.Tests.csproj", "{BC267EA5-FC39-41CA-A032-84AB5AF0AFD4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C9D7F653-E589-44CE-9D41-89821F4F9E4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C9D7F653-E589-44CE-9D41-89821F4F9E4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9D7F653-E589-44CE-9D41-89821F4F9E4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C9D7F653-E589-44CE-9D41-89821F4F9E4E}.Release|Any CPU.Build.0 = Release|Any CPU
{B48B10DD-E450-49AF-A1FA-102AC165DEEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B48B10DD-E450-49AF-A1FA-102AC165DEEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B48B10DD-E450-49AF-A1FA-102AC165DEEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B48B10DD-E450-49AF-A1FA-102AC165DEEA}.Release|Any CPU.Build.0 = Release|Any CPU
{65C3A21B-D946-45B6-8A7E-2DBB98E35E0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{65C3A21B-D946-45B6-8A7E-2DBB98E35E0C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{65C3A21B-D946-45B6-8A7E-2DBB98E35E0C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{65C3A21B-D946-45B6-8A7E-2DBB98E35E0C}.Release|Any CPU.Build.0 = Release|Any CPU
{BC267EA5-FC39-41CA-A032-84AB5AF0AFD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC267EA5-FC39-41CA-A032-84AB5AF0AFD4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC267EA5-FC39-41CA-A032-84AB5AF0AFD4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC267EA5-FC39-41CA-A032-84AB5AF0AFD4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
15 changes: 15 additions & 0 deletions src/Backup/SampleWebsite.Mvc3/App_Start/MvcMembership.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Web.Mvc;
using MvcMembership;

[assembly: WebActivator.PreApplicationStartMethod(typeof(SampleWebsite.Mvc3.App_Start.MvcMembership), "Start")]

namespace SampleWebsite.Mvc3.App_Start
{
public static class MvcMembership
{
public static void Start()
{
GlobalFilters.Filters.Add(new TouchUserOnEachVisitFilter());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using DataAnnotationsExtensions.ClientValidation;

[assembly: WebActivator.PreApplicationStartMethod(typeof(SampleWebsite.Mvc3.App_Start.RegisterClientValidationExtensions), "Start")]

namespace SampleWebsite.Mvc3.App_Start {
public static class RegisterClientValidationExtensions {
public static void Start() {
DataAnnotationsModelValidatorProviderExtensions.RegisterValidationExtensions();
}
}
}
Loading