diff options
-rw-r--r-- | projecttemplates/MvcRelyingParty/Views/Shared/LogOnUserControl.ascx | 31 | ||||
-rw-r--r-- | projecttemplates/MvcRelyingParty/Web.config | 1 |
2 files changed, 24 insertions, 8 deletions
diff --git a/projecttemplates/MvcRelyingParty/Views/Shared/LogOnUserControl.ascx b/projecttemplates/MvcRelyingParty/Views/Shared/LogOnUserControl.ascx index 0e7120e..9c8d139 100644 --- a/projecttemplates/MvcRelyingParty/Views/Shared/LogOnUserControl.ascx +++ b/projecttemplates/MvcRelyingParty/Views/Shared/LogOnUserControl.ascx @@ -1,14 +1,29 @@ <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> +<%@ Import Namespace="RelyingPartyLogic" %> +<%@ Import Namespace="System.Linq" %> <% - if (Request.IsAuthenticated) { + if (Request.IsAuthenticated) { %> - Welcome <b><%= Html.Encode(Page.User.Identity.Name) %></b>! - [ <%= Html.ActionLink("Log Off", "LogOff", "Account") %> ] +Welcome <b> + <% + var authToken = Database.DataContext.AuthenticationTokens.Include("User").First(token => token.ClaimedIdentifier == Page.User.Identity.Name); + if (!string.IsNullOrEmpty(authToken.User.EmailAddress)) { + Response.Write(HttpUtility.HtmlEncode(authToken.User.EmailAddress)); + } else if (!string.IsNullOrEmpty(authToken.User.FirstName)) { + Response.Write(HttpUtility.HtmlEncode(authToken.User.FirstName)); + } else { + Response.Write(HttpUtility.HtmlEncode(authToken.FriendlyIdentifier)); + } + %> +</b>! [ +<%= Html.ActionLink("Log Off", "LogOff", "Account") %> +] <% - } - else { -%> - [ <%= Html.ActionLink("Log On", "LogOn", "Account") %> ] + } else { +%> +[ +<%= Html.ActionLink("Log On", "LogOn", "Account") %> +] <% - } + } %> diff --git a/projecttemplates/MvcRelyingParty/Web.config b/projecttemplates/MvcRelyingParty/Web.config index 18fbaeb..da17c5a 100644 --- a/projecttemplates/MvcRelyingParty/Web.config +++ b/projecttemplates/MvcRelyingParty/Web.config @@ -162,6 +162,7 @@ <add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> + <add assembly="System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> </assemblies> |