summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-12-29 07:59:02 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2009-12-29 07:59:02 -0800
commit97c7c0467bf535ad07318c69295e47f71e3071e6 (patch)
tree2b49e658c1c8a59822950a9e1bad3ed51a23e010
parent60f1e560df992e9bfd31984f290e0e5cb11f46ec (diff)
downloadDotNetOpenAuth-97c7c0467bf535ad07318c69295e47f71e3071e6.zip
DotNetOpenAuth-97c7c0467bf535ad07318c69295e47f71e3071e6.tar.gz
DotNetOpenAuth-97c7c0467bf535ad07318c69295e47f71e3071e6.tar.bz2
Fixed username display so it uses the friendly identifier or email.
-rw-r--r--projecttemplates/MvcRelyingParty/Views/Shared/LogOnUserControl.ascx31
-rw-r--r--projecttemplates/MvcRelyingParty/Web.config1
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>