diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-12-30 07:37:37 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-12-30 07:37:37 -0800 |
commit | fe0bcb80dcc2f38ffb58d2de433dbc6cfae22be2 (patch) | |
tree | 966e3bbada14dd4dccefd77943d9dc1d7e61d5ae /projecttemplates/MvcRelyingParty/Controllers/AccountController.cs | |
parent | 2cec9b5a841dee8cb0326c5d4ff27901a684c749 (diff) | |
download | DotNetOpenAuth-fe0bcb80dcc2f38ffb58d2de433dbc6cfae22be2.zip DotNetOpenAuth-fe0bcb80dcc2f38ffb58d2de433dbc6cfae22be2.tar.gz DotNetOpenAuth-fe0bcb80dcc2f38ffb58d2de433dbc6cfae22be2.tar.bz2 |
Added an Account Info page.
Diffstat (limited to 'projecttemplates/MvcRelyingParty/Controllers/AccountController.cs')
-rw-r--r-- | projecttemplates/MvcRelyingParty/Controllers/AccountController.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs b/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs index 05bffe4..03eb505 100644 --- a/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs +++ b/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs @@ -12,6 +12,7 @@ using DotNetOpenAuth.OpenId; using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; using DotNetOpenAuth.OpenId.RelyingParty; + using MvcRelyingParty.Models; using RelyingPartyLogic; [HandleError] @@ -148,5 +149,37 @@ this.FormsAuth.SignOut(); return RedirectToAction("Index", "Home"); } + + public ActionResult Edit() { + var model = new AccountInfoModel { + FirstName = Database.LoggedInUser.FirstName, + LastName = Database.LoggedInUser.LastName, + EmailAddress = Database.LoggedInUser.EmailAddress, + }; + return View(model); + } + + /// <summary> + /// Updates the user's account information. + /// </summary> + /// <param name="firstName">The first name.</param> + /// <param name="lastName">The last name.</param> + /// <param name="emailAddress">The email address.</param> + /// <returns>An updated view showing the new profile.</returns> + /// <remarks> + /// This action accepts PUT because this operation is idempotent in nature. + /// </remarks> + [AcceptVerbs(HttpVerbs.Put), ValidateAntiForgeryToken] + public ActionResult Update(string firstName, string lastName, string emailAddress) { + Database.LoggedInUser.FirstName = firstName; + Database.LoggedInUser.LastName = lastName; + + if (Database.LoggedInUser.EmailAddress != emailAddress) { + Database.LoggedInUser.EmailAddress = emailAddress; + Database.LoggedInUser.EmailAddressVerified = false; + } + + return new EmptyResult(); + } } } |