Ports behaviour from membershiphelper from v7 to 6 to make them the same

This commit is contained in:
Sebastiaan Janssen
2014-04-02 11:42:48 +02:00
parent d9c66cd4b3
commit a768fe5bb3

View File

@@ -276,8 +276,15 @@ namespace Umbraco.Web.Security
{
var membershipUser = provider.GetCurrentUser();
var member = GetCurrentMember();
//this shouldn't happen
if (member == null) return null;
//this shouldn't happen but will if the member is deleted in the back office while the member is trying
// to use the front-end!
if (member == null)
{
//log them out since they've been removed
FormsAuthentication.SignOut();
return null;
}
var model = ProfileModel.CreateModel();
model.Name = member.Name;
@@ -416,8 +423,15 @@ namespace Umbraco.Web.Security
if (provider.IsUmbracoMembershipProvider())
{
var member = GetCurrentMember();
//this shouldn't happen
if (member == null) return model;
//this shouldn't happen but will if the member is deleted in the back office while the member is trying
// to use the front-end!
if (member == null)
{
//log them out since they've been removed
FormsAuthentication.SignOut();
model.IsLoggedIn = false;
return model;
}
model.Name = member.Name;
model.Username = member.Username;
model.Email = member.Email;
@@ -425,8 +439,15 @@ namespace Umbraco.Web.Security
else
{
var member = provider.GetCurrentUser();
//this shouldn't happen
if (member == null) return null;
//this shouldn't happen but will if the member is deleted in the back office while the member is trying
// to use the front-end!
if (member == null)
{
//log them out since they've been removed
FormsAuthentication.SignOut();
model.IsLoggedIn = false;
return model;
}
model.Name = member.UserName;
model.Username = member.UserName;
model.Email = member.Email;