2014-01-28 13:35:43 +11:00
using System ;
using System.Linq ;
2013-08-28 17:52:06 +02:00
using System.Web.Mvc ;
2014-01-28 13:35:43 +11:00
using System.Web.Security ;
2013-08-28 17:52:06 +02:00
using System.Xml ;
using umbraco.cms.businesslogic.member ;
using Umbraco.Web.Models ;
using Umbraco.Web.Mvc ;
2014-01-28 13:35:43 +11:00
using Umbraco.Core.Security ;
2013-08-28 17:52:06 +02:00
namespace Umbraco.Web.Controllers
{
2014-01-28 13:47:16 +11:00
public class UmbProfileController : SurfaceController
2013-08-28 17:52:06 +02:00
{
[HttpPost]
2014-01-28 13:35:43 +11:00
public ActionResult HandleUpdateProfile ( [ Bind ( Prefix = "profileModel" ) ] ProfileModel model )
2013-08-28 17:52:06 +02:00
{
2014-01-28 13:35:43 +11:00
if ( Membership . Provider . IsUmbracoMembershipProvider ( ) = = false )
2013-08-28 17:52:06 +02:00
{
2014-01-28 13:47:16 +11:00
throw new NotSupportedException ( "Profile editing with the " + typeof ( UmbProfileController ) + " is not supported when not using the default Umbraco membership provider" ) ;
2014-01-28 13:35:43 +11:00
}
2013-08-28 17:52:06 +02:00
2014-01-28 13:35:43 +11:00
if ( ModelState . IsValid = = false )
{
return CurrentUmbracoPage ( ) ;
}
2013-08-28 17:52:06 +02:00
2014-01-28 21:57:00 +11:00
Members . UpdateMemberProfile ( model ) ;
2014-01-28 13:35:43 +11:00
//TODO: Why are we redirecting to home again here??
return Redirect ( "/" ) ;
2013-08-28 17:52:06 +02:00
}
}
}