|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.IO;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Net.Mail;
|
|
|
|
using System.Web;
|
|
|
|
using System.Web.Configuration;
|
|
|
|
using System.Web.Profile;
|
|
|
|
using System.Web.Security;
|
|
|
|
using Yavsc;
|
|
|
|
using Yavsc.Model.RolesAndMembers;
|
|
|
|
using Yavsc.Helpers;
|
|
|
|
using System.Web.Mvc;
|
|
|
|
using Yavsc.Model.Circles;
|
|
|
|
using System.Collections.Specialized;
|
|
|
|
using System.Text;
|
|
|
|
using System.Net;
|
|
|
|
using System.Configuration;
|
|
|
|
|
|
|
|
namespace Yavsc.Controllers
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Account controller.
|
|
|
|
/// </summary>
|
|
|
|
public class AccountController : Controller
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Avatar the specified user.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id">User.</param>
|
|
|
|
[AcceptVerbs (HttpVerbs.Get)]
|
|
|
|
public ActionResult Avatar (string id)
|
|
|
|
{
|
|
|
|
string avatarLocation = Url.AvatarUrl (id);
|
|
|
|
WebRequest wr = WebRequest.Create (avatarLocation);
|
|
|
|
FileContentResult res;
|
|
|
|
using (WebResponse resp = wr.GetResponse ()) {
|
|
|
|
using (Stream str = resp.GetResponseStream ()) {
|
|
|
|
byte[] content = new byte[str.Length];
|
|
|
|
str.Read (content, 0, (int)str.Length);
|
|
|
|
res = File (content, resp.ContentType);
|
|
|
|
wr.Abort ();
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Index this instance.
|
|
|
|
/// </summary>
|
|
|
|
public ActionResult Index ()
|
|
|
|
{
|
|
|
|
return View ();
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO [ValidateAntiForgeryToken]
|
|
|
|
/// <summary>
|
|
|
|
/// Does login.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>The login.</returns>
|
|
|
|
/// <param name="model">Model.</param>
|
|
|
|
/// <param name="returnUrl">Return URL.</param>
|
|
|
|
[HttpPost]
|
|
|
|
public ActionResult Login (LoginModel model, string returnUrl)
|
|
|
|
{
|
|
|
|
if (ModelState.IsValid) {
|
|
|
|
if (Membership.ValidateUser (model.UserName, model.Password)) {
|
|
|
|
FormsAuthentication.SetAuthCookie (model.UserName, model.RememberMe);
|
|
|
|
if (returnUrl != null)
|
|
|
|
return Redirect (returnUrl);
|
|
|
|
else
|
|
|
|
return View ("Index");
|
|
|
|
} else {
|
|
|
|
ModelState.AddModelError ("UserName", "The user name or password provided is incorrect.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ViewData ["returnUrl"] = returnUrl;
|
|
|
|
return View (model);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Login the specified returnUrl.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="returnUrl">Return URL.</param>
|
|
|
|
[HttpGet]
|
|
|
|
public ActionResult Login (string returnUrl)
|
|
|
|
{
|
|
|
|
ViewData ["returnUrl"] = returnUrl;
|
|
|
|
return View ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Registers the form.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>The form.</returns>
|
|
|
|
public ActionResult RegisterForm()
|
|
|
|
{
|
|
|
|
return View ("Register");
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Register the specified model and returnUrl.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="model">Model.</param>
|
|
|
|
/// <param name="returnUrl">Return URL.</param>
|
|
|
|
[HttpPost]
|
|
|
|
public ActionResult Register (RegisterViewModel model, string returnUrl)
|
|
|
|
{
|
|
|
|
ViewData ["returnUrl"] = returnUrl;
|
|
|
|
if (Request.RequestType == "GET") {
|
|
|
|
foreach (string k in ModelState.Keys)
|
|
|
|
ModelState [k].Errors.Clear ();
|
|
|
|
return View (model);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ModelState.IsValid) {
|
|
|
|
if (model.ConfirmPassword != model.Password) {
|
|
|
|
ModelState.AddModelError ("ConfirmPassword", "Veuillez confirmer votre mot de passe");
|
|
|
|
return View (model);
|
|
|
|
}
|
|
|
|
|
|
|
|
MembershipCreateStatus mcs;
|
|
|
|
var user = Membership.CreateUser (
|
|
|
|
model.UserName,
|
|
|
|
model.Password,
|
|
|
|
model.Email,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
false,
|
|
|
|
out mcs);
|
|
|
|
switch (mcs) {
|
|
|
|
case MembershipCreateStatus.DuplicateEmail:
|
|
|
|
ModelState.AddModelError ("Email", "Cette adresse e-mail correspond " +
|
|
|
|
"à un compte utilisateur existant");
|
|
|
|
return View (model);
|
|
|
|
case MembershipCreateStatus.DuplicateUserName:
|
|
|
|
ModelState.AddModelError ("UserName", "Ce nom d'utilisateur est " +
|
|
|
|
"déjà enregistré");
|
|
|
|
return View (model);
|
|
|
|
case MembershipCreateStatus.Success:
|
|
|
|
Url.SendActivationMessage (user);
|
|
|
|
ViewData ["username"] = user.UserName;
|
|
|
|
ViewData ["email"] = user.Email;
|
|
|
|
return View ("RegistrationPending");
|
|
|
|
default:
|
|
|
|
ViewData ["Error"] = "Une erreur inattendue s'est produite" +
|
|
|
|
"a l'enregistrement de votre compte utilisateur" +
|
|
|
|
string.Format ("({0}).", mcs.ToString ()) +
|
|
|
|
"Veuillez pardonner la gêne" +
|
|
|
|
"occasionnée";
|
|
|
|
return View (model);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return View (model);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Changes the password success.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>The password success.</returns>
|
|
|
|
public ActionResult ChangePasswordSuccess ()
|
|
|
|
{
|
|
|
|
return View ();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Changes the password.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>The password.</returns>
|
|
|
|
[HttpGet]
|
|
|
|
[Authorize]
|
|
|
|
public ActionResult ChangePassword ()
|
|
|
|
{
|
|
|
|
return View ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Unregister the specified id and confirmed.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id">Identifier.</param>
|
|
|
|
/// <param name="confirmed">If set to <c>true</c> confirmed.</param>
|
|
|
|
[Authorize]
|
|
|
|
public ActionResult Unregister (string id, bool confirmed = false)
|
|
|
|
{
|
|
|
|
ViewData ["UserName"] = id;
|
|
|
|
if (!confirmed)
|
|
|
|
return View ();
|
|
|
|
string logged = Membership.GetUser ().UserName;
|
|
|
|
if (logged != id)
|
|
|
|
if (!Roles.IsUserInRole ("Admin"))
|
|
|
|
throw new Exception ("Unregister another user");
|
|
|
|
|
|
|
|
Membership.DeleteUser (
|
|
|
|
Membership.GetUser ().UserName);
|
|
|
|
return RedirectToAction ("Index", "Home");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Changes the password.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>The password.</returns>
|
|
|
|
/// <param name="model">Model.</param>
|
|
|
|
[Authorize]
|
|
|
|
[HttpPost]
|
|
|
|
public ActionResult ChangePassword (ChangePasswordModel model)
|
|
|
|
{
|
|
|
|
if (ModelState.IsValid) {
|
|
|
|
|
|
|
|
// ChangePassword will throw an exception rather
|
|
|
|
// than return false in certain failure scenarios.
|
|
|
|
bool changePasswordSucceeded = false;
|
|
|
|
try {
|
|
|
|
MembershipUserCollection users =
|
|
|
|
Membership.FindUsersByName (model.Username);
|
|
|
|
if (users.Count > 0) {
|
|
|
|
MembershipUser user = Membership.GetUser (model.Username, true);
|
|
|
|
|
|
|
|
changePasswordSucceeded = user.ChangePassword (model.OldPassword, model.NewPassword);
|
|
|
|
} else {
|
|
|
|
changePasswordSucceeded = false;
|
|
|
|
ModelState.AddModelError ("Username", "The user name not found.");
|
|
|
|
}
|
|
|
|
} catch (Exception ex) {
|
|
|
|
ViewData ["Error"] = ex.ToString ();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (changePasswordSucceeded) {
|
|
|
|
return RedirectToAction ("ChangePasswordSuccess");
|
|
|
|
} else {
|
|
|
|
ModelState.AddModelError ("Password", "The current password is incorrect or the new password is invalid.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If we got this far, something failed, redisplay form
|
|
|
|
return View (model);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Profile the specified id.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id">Identifier.</param>
|
|
|
|
[Authorize]
|
|
|
|
[HttpGet]
|
* bg.gif:
* asc.gif:
* desc.gif:
* style.css: moved to App_Themes
* style.css:
* bg.gif:
* asc.gif:
* bg.png:
* rect.png:
* asc.png:
* desc.gif:
* jquery-ui.css:
* mdd_styles.css:
* croix.png:
* desc.png:
* style.css:
* jquery-ui.min.css:
* mdd_gripper.png:
* mdd_toolbar.png:
* jquery.timepicker.css:
* mdd_ajax_loader.gif:
* mdd_modal_background.png: moved to /App_Themes
* NpgsqlBlogProvider.cs: * Remove post by id
* Manage collections of entries on a couple (user,title), not a single
post
* NpgsqlCircleProvider.cs: Fixes the "Match" method.
* IDbModule.cs:
* Edit.aspx:
* Estimates.aspx:
* WorkFlowManager.cs:
* NpgsqlContentProvider.cs: refactoring
* NpgsqlMRPProviders.csproj: new NpgsqlUserName provider
* NpgsqlRoleProvider.cs: simpler init method
* NpgsqlUserNameProvider.cs: impements a UserNameProvider
* MyClass.cs: refactoring from Yavsc.Model
* BlogsController.cs: access control simplified
* FrontOfficeController.cs: Pdf generation made public ni case of
formatting exception
* mdd_styles.css: Theme -> App_Themes
* style.css: yet another style impact
* AccountController.cs: Fixes the user name modification
* BlogsController.cs: * Fixes the removal process
* On a title and user name, we get collection of posts, not only one.
* Implements an Access on circle
* FrontOfficeController.cs: * implements a new Get method.
* ensure a membership existence before delivering an estimate.
* GoogleController.cs: Fixes the user name modification on a Google
account
* ErrorHtmlFormatter.cs: nice error message in html (using Markdown
helper)
* FormatterException.cs: formatter exception exposes error and
standard output of the process
* TexToPdfFormatter.cs: * generates temporary files in the folder
returned by Path.GetTempPath()
* throws FormatterException
* Global.asax.cs: new route map:
Blogs/{action}/{user}/{title}
Blog/{user}/{title}
B/{id}
{controller}/{action}/{id}
* App.master: * refactoring: Theme moved to App_Themes
* a link to the logged user's blog
*
* NoLogin.master: refactoring: Theme moved to App_Themes
* Circles.aspx: refactoring : circles now are given as select items
* Login.aspx: fixes the html presentation
* Register.aspx: Fixes a Typo
* Index.aspx: Implements a blog index, due to M&C changes with this
commit
* RemovePost.aspx: links to the new route to the "RemovePost" action,
giving it a post id
* RemoveTitle.aspx: fixes a not yet linked page to remove a post
collection under a given title
* EventPub.aspx: code refactoring
* Writting.ascx: cleans the code
* Web.config: fills the config with new names in the space
* Web.config: configures the new NpgsqlUserNameProvider
* Web.csproj: refactoring and others
* BlogEntryCollection.cs: implement the BlogEntryCollection
* BlogManager.cs: the manager helps to filter on access
* BlogProvider.cs: The title is not unique anymore, and one can modify
it, post a lot under it, drop all posts under it.
A Post is deleted by id.
* UUBlogEntryCollection.cs: implements a collection of post under a
given user name.
* UUTBlogEntryCollection.cs: implements a collection of post under a
given couple (user name, title).
* ListItem.cs: ListItem is declared obsolete in this model, helpers
can build MVC SelectListItem on data returned by the manager.
* LocalizedText.Designer.cs:
* LocalizedText.fr.Designer.cs: autogenerated from xml
* LocalizedText.resx:
* LocalizedText.fr.resx: new labels
* ChangeUserNameProvider.cs: xml doc
* Profile.cs: the UserName property is read only, and comes from
authentication, to change it, we set a Name and validate it agains
the "Profile" method
* UserManager.cs: simpler code a init time
* IContentProvider.cs: implements the new IDataProvider interface
* IDataProvider.cs: defines the new IDataProvider interface
* YavscModel.csproj: includes new classes
* UserPosts.aspx: adds a link to remove a post
* UserPost.aspx: now uses the new BlogEntryCollection object
9 years ago
|
|
|
public ActionResult Profile (string id)
|
|
|
|
{
|
* bg.gif:
* asc.gif:
* desc.gif:
* style.css: moved to App_Themes
* style.css:
* bg.gif:
* asc.gif:
* bg.png:
* rect.png:
* asc.png:
* desc.gif:
* jquery-ui.css:
* mdd_styles.css:
* croix.png:
* desc.png:
* style.css:
* jquery-ui.min.css:
* mdd_gripper.png:
* mdd_toolbar.png:
* jquery.timepicker.css:
* mdd_ajax_loader.gif:
* mdd_modal_background.png: moved to /App_Themes
* NpgsqlBlogProvider.cs: * Remove post by id
* Manage collections of entries on a couple (user,title), not a single
post
* NpgsqlCircleProvider.cs: Fixes the "Match" method.
* IDbModule.cs:
* Edit.aspx:
* Estimates.aspx:
* WorkFlowManager.cs:
* NpgsqlContentProvider.cs: refactoring
* NpgsqlMRPProviders.csproj: new NpgsqlUserName provider
* NpgsqlRoleProvider.cs: simpler init method
* NpgsqlUserNameProvider.cs: impements a UserNameProvider
* MyClass.cs: refactoring from Yavsc.Model
* BlogsController.cs: access control simplified
* FrontOfficeController.cs: Pdf generation made public ni case of
formatting exception
* mdd_styles.css: Theme -> App_Themes
* style.css: yet another style impact
* AccountController.cs: Fixes the user name modification
* BlogsController.cs: * Fixes the removal process
* On a title and user name, we get collection of posts, not only one.
* Implements an Access on circle
* FrontOfficeController.cs: * implements a new Get method.
* ensure a membership existence before delivering an estimate.
* GoogleController.cs: Fixes the user name modification on a Google
account
* ErrorHtmlFormatter.cs: nice error message in html (using Markdown
helper)
* FormatterException.cs: formatter exception exposes error and
standard output of the process
* TexToPdfFormatter.cs: * generates temporary files in the folder
returned by Path.GetTempPath()
* throws FormatterException
* Global.asax.cs: new route map:
Blogs/{action}/{user}/{title}
Blog/{user}/{title}
B/{id}
{controller}/{action}/{id}
* App.master: * refactoring: Theme moved to App_Themes
* a link to the logged user's blog
*
* NoLogin.master: refactoring: Theme moved to App_Themes
* Circles.aspx: refactoring : circles now are given as select items
* Login.aspx: fixes the html presentation
* Register.aspx: Fixes a Typo
* Index.aspx: Implements a blog index, due to M&C changes with this
commit
* RemovePost.aspx: links to the new route to the "RemovePost" action,
giving it a post id
* RemoveTitle.aspx: fixes a not yet linked page to remove a post
collection under a given title
* EventPub.aspx: code refactoring
* Writting.ascx: cleans the code
* Web.config: fills the config with new names in the space
* Web.config: configures the new NpgsqlUserNameProvider
* Web.csproj: refactoring and others
* BlogEntryCollection.cs: implement the BlogEntryCollection
* BlogManager.cs: the manager helps to filter on access
* BlogProvider.cs: The title is not unique anymore, and one can modify
it, post a lot under it, drop all posts under it.
A Post is deleted by id.
* UUBlogEntryCollection.cs: implements a collection of post under a
given user name.
* UUTBlogEntryCollection.cs: implements a collection of post under a
given couple (user name, title).
* ListItem.cs: ListItem is declared obsolete in this model, helpers
can build MVC SelectListItem on data returned by the manager.
* LocalizedText.Designer.cs:
* LocalizedText.fr.Designer.cs: autogenerated from xml
* LocalizedText.resx:
* LocalizedText.fr.resx: new labels
* ChangeUserNameProvider.cs: xml doc
* Profile.cs: the UserName property is read only, and comes from
authentication, to change it, we set a Name and validate it agains
the "Profile" method
* UserManager.cs: simpler code a init time
* IContentProvider.cs: implements the new IDataProvider interface
* IDataProvider.cs: defines the new IDataProvider interface
* YavscModel.csproj: includes new classes
* UserPosts.aspx: adds a link to remove a post
* UserPost.aspx: now uses the new BlogEntryCollection object
9 years ago
|
|
|
if (id == null)
|
|
|
|
id = Membership.GetUser ().UserName;
|
|
|
|
ViewData ["UserName"] = id;
|
|
|
|
Profile model = new Profile (ProfileBase.Create (id));
|
|
|
|
model.RememberMe = FormsAuthentication.GetAuthCookie (id, true) == null;
|
|
|
|
return View (model);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Profile the specified id, model and AvatarFile.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id">Identifier.</param>
|
|
|
|
/// <param name="model">Model.</param>
|
|
|
|
/// <param name="AvatarFile">Avatar file.</param>
|
|
|
|
[Authorize]
|
|
|
|
[HttpPost]
|
* bg.gif:
* asc.gif:
* desc.gif:
* style.css: moved to App_Themes
* style.css:
* bg.gif:
* asc.gif:
* bg.png:
* rect.png:
* asc.png:
* desc.gif:
* jquery-ui.css:
* mdd_styles.css:
* croix.png:
* desc.png:
* style.css:
* jquery-ui.min.css:
* mdd_gripper.png:
* mdd_toolbar.png:
* jquery.timepicker.css:
* mdd_ajax_loader.gif:
* mdd_modal_background.png: moved to /App_Themes
* NpgsqlBlogProvider.cs: * Remove post by id
* Manage collections of entries on a couple (user,title), not a single
post
* NpgsqlCircleProvider.cs: Fixes the "Match" method.
* IDbModule.cs:
* Edit.aspx:
* Estimates.aspx:
* WorkFlowManager.cs:
* NpgsqlContentProvider.cs: refactoring
* NpgsqlMRPProviders.csproj: new NpgsqlUserName provider
* NpgsqlRoleProvider.cs: simpler init method
* NpgsqlUserNameProvider.cs: impements a UserNameProvider
* MyClass.cs: refactoring from Yavsc.Model
* BlogsController.cs: access control simplified
* FrontOfficeController.cs: Pdf generation made public ni case of
formatting exception
* mdd_styles.css: Theme -> App_Themes
* style.css: yet another style impact
* AccountController.cs: Fixes the user name modification
* BlogsController.cs: * Fixes the removal process
* On a title and user name, we get collection of posts, not only one.
* Implements an Access on circle
* FrontOfficeController.cs: * implements a new Get method.
* ensure a membership existence before delivering an estimate.
* GoogleController.cs: Fixes the user name modification on a Google
account
* ErrorHtmlFormatter.cs: nice error message in html (using Markdown
helper)
* FormatterException.cs: formatter exception exposes error and
standard output of the process
* TexToPdfFormatter.cs: * generates temporary files in the folder
returned by Path.GetTempPath()
* throws FormatterException
* Global.asax.cs: new route map:
Blogs/{action}/{user}/{title}
Blog/{user}/{title}
B/{id}
{controller}/{action}/{id}
* App.master: * refactoring: Theme moved to App_Themes
* a link to the logged user's blog
*
* NoLogin.master: refactoring: Theme moved to App_Themes
* Circles.aspx: refactoring : circles now are given as select items
* Login.aspx: fixes the html presentation
* Register.aspx: Fixes a Typo
* Index.aspx: Implements a blog index, due to M&C changes with this
commit
* RemovePost.aspx: links to the new route to the "RemovePost" action,
giving it a post id
* RemoveTitle.aspx: fixes a not yet linked page to remove a post
collection under a given title
* EventPub.aspx: code refactoring
* Writting.ascx: cleans the code
* Web.config: fills the config with new names in the space
* Web.config: configures the new NpgsqlUserNameProvider
* Web.csproj: refactoring and others
* BlogEntryCollection.cs: implement the BlogEntryCollection
* BlogManager.cs: the manager helps to filter on access
* BlogProvider.cs: The title is not unique anymore, and one can modify
it, post a lot under it, drop all posts under it.
A Post is deleted by id.
* UUBlogEntryCollection.cs: implements a collection of post under a
given user name.
* UUTBlogEntryCollection.cs: implements a collection of post under a
given couple (user name, title).
* ListItem.cs: ListItem is declared obsolete in this model, helpers
can build MVC SelectListItem on data returned by the manager.
* LocalizedText.Designer.cs:
* LocalizedText.fr.Designer.cs: autogenerated from xml
* LocalizedText.resx:
* LocalizedText.fr.resx: new labels
* ChangeUserNameProvider.cs: xml doc
* Profile.cs: the UserName property is read only, and comes from
authentication, to change it, we set a Name and validate it agains
the "Profile" method
* UserManager.cs: simpler code a init time
* IContentProvider.cs: implements the new IDataProvider interface
* IDataProvider.cs: defines the new IDataProvider interface
* YavscModel.csproj: includes new classes
* UserPosts.aspx: adds a link to remove a post
* UserPost.aspx: now uses the new BlogEntryCollection object
9 years ago
|
|
|
public ActionResult Profile (string id, Profile model, HttpPostedFileBase AvatarFile)
|
|
|
|
{
|
|
|
|
// ASSERT("Membership.GetUser ().UserName is made of simple characters, no slash nor backslash"
|
|
|
|
|
|
|
|
string logdu = Membership.GetUser ().UserName;
|
|
|
|
if (string.IsNullOrWhiteSpace (id))
|
|
|
|
id = logdu;
|
* bg.gif:
* asc.gif:
* desc.gif:
* style.css: moved to App_Themes
* style.css:
* bg.gif:
* asc.gif:
* bg.png:
* rect.png:
* asc.png:
* desc.gif:
* jquery-ui.css:
* mdd_styles.css:
* croix.png:
* desc.png:
* style.css:
* jquery-ui.min.css:
* mdd_gripper.png:
* mdd_toolbar.png:
* jquery.timepicker.css:
* mdd_ajax_loader.gif:
* mdd_modal_background.png: moved to /App_Themes
* NpgsqlBlogProvider.cs: * Remove post by id
* Manage collections of entries on a couple (user,title), not a single
post
* NpgsqlCircleProvider.cs: Fixes the "Match" method.
* IDbModule.cs:
* Edit.aspx:
* Estimates.aspx:
* WorkFlowManager.cs:
* NpgsqlContentProvider.cs: refactoring
* NpgsqlMRPProviders.csproj: new NpgsqlUserName provider
* NpgsqlRoleProvider.cs: simpler init method
* NpgsqlUserNameProvider.cs: impements a UserNameProvider
* MyClass.cs: refactoring from Yavsc.Model
* BlogsController.cs: access control simplified
* FrontOfficeController.cs: Pdf generation made public ni case of
formatting exception
* mdd_styles.css: Theme -> App_Themes
* style.css: yet another style impact
* AccountController.cs: Fixes the user name modification
* BlogsController.cs: * Fixes the removal process
* On a title and user name, we get collection of posts, not only one.
* Implements an Access on circle
* FrontOfficeController.cs: * implements a new Get method.
* ensure a membership existence before delivering an estimate.
* GoogleController.cs: Fixes the user name modification on a Google
account
* ErrorHtmlFormatter.cs: nice error message in html (using Markdown
helper)
* FormatterException.cs: formatter exception exposes error and
standard output of the process
* TexToPdfFormatter.cs: * generates temporary files in the folder
returned by Path.GetTempPath()
* throws FormatterException
* Global.asax.cs: new route map:
Blogs/{action}/{user}/{title}
Blog/{user}/{title}
B/{id}
{controller}/{action}/{id}
* App.master: * refactoring: Theme moved to App_Themes
* a link to the logged user's blog
*
* NoLogin.master: refactoring: Theme moved to App_Themes
* Circles.aspx: refactoring : circles now are given as select items
* Login.aspx: fixes the html presentation
* Register.aspx: Fixes a Typo
* Index.aspx: Implements a blog index, due to M&C changes with this
commit
* RemovePost.aspx: links to the new route to the "RemovePost" action,
giving it a post id
* RemoveTitle.aspx: fixes a not yet linked page to remove a post
collection under a given title
* EventPub.aspx: code refactoring
* Writting.ascx: cleans the code
* Web.config: fills the config with new names in the space
* Web.config: configures the new NpgsqlUserNameProvider
* Web.csproj: refactoring and others
* BlogEntryCollection.cs: implement the BlogEntryCollection
* BlogManager.cs: the manager helps to filter on access
* BlogProvider.cs: The title is not unique anymore, and one can modify
it, post a lot under it, drop all posts under it.
A Post is deleted by id.
* UUBlogEntryCollection.cs: implements a collection of post under a
given user name.
* UUTBlogEntryCollection.cs: implements a collection of post under a
given couple (user name, title).
* ListItem.cs: ListItem is declared obsolete in this model, helpers
can build MVC SelectListItem on data returned by the manager.
* LocalizedText.Designer.cs:
* LocalizedText.fr.Designer.cs: autogenerated from xml
* LocalizedText.resx:
* LocalizedText.fr.resx: new labels
* ChangeUserNameProvider.cs: xml doc
* Profile.cs: the UserName property is read only, and comes from
authentication, to change it, we set a Name and validate it agains
the "Profile" method
* UserManager.cs: simpler code a init time
* IContentProvider.cs: implements the new IDataProvider interface
* IDataProvider.cs: defines the new IDataProvider interface
* YavscModel.csproj: includes new classes
* UserPosts.aspx: adds a link to remove a post
* UserPost.aspx: now uses the new BlogEntryCollection object
9 years ago
|
|
|
ViewData ["UserName"] = id;
|
|
|
|
bool editsMyName = (string.Compare(id,logdu)==0);
|
* bg.gif:
* asc.gif:
* desc.gif:
* style.css: moved to App_Themes
* style.css:
* bg.gif:
* asc.gif:
* bg.png:
* rect.png:
* asc.png:
* desc.gif:
* jquery-ui.css:
* mdd_styles.css:
* croix.png:
* desc.png:
* style.css:
* jquery-ui.min.css:
* mdd_gripper.png:
* mdd_toolbar.png:
* jquery.timepicker.css:
* mdd_ajax_loader.gif:
* mdd_modal_background.png: moved to /App_Themes
* NpgsqlBlogProvider.cs: * Remove post by id
* Manage collections of entries on a couple (user,title), not a single
post
* NpgsqlCircleProvider.cs: Fixes the "Match" method.
* IDbModule.cs:
* Edit.aspx:
* Estimates.aspx:
* WorkFlowManager.cs:
* NpgsqlContentProvider.cs: refactoring
* NpgsqlMRPProviders.csproj: new NpgsqlUserName provider
* NpgsqlRoleProvider.cs: simpler init method
* NpgsqlUserNameProvider.cs: impements a UserNameProvider
* MyClass.cs: refactoring from Yavsc.Model
* BlogsController.cs: access control simplified
* FrontOfficeController.cs: Pdf generation made public ni case of
formatting exception
* mdd_styles.css: Theme -> App_Themes
* style.css: yet another style impact
* AccountController.cs: Fixes the user name modification
* BlogsController.cs: * Fixes the removal process
* On a title and user name, we get collection of posts, not only one.
* Implements an Access on circle
* FrontOfficeController.cs: * implements a new Get method.
* ensure a membership existence before delivering an estimate.
* GoogleController.cs: Fixes the user name modification on a Google
account
* ErrorHtmlFormatter.cs: nice error message in html (using Markdown
helper)
* FormatterException.cs: formatter exception exposes error and
standard output of the process
* TexToPdfFormatter.cs: * generates temporary files in the folder
returned by Path.GetTempPath()
* throws FormatterException
* Global.asax.cs: new route map:
Blogs/{action}/{user}/{title}
Blog/{user}/{title}
B/{id}
{controller}/{action}/{id}
* App.master: * refactoring: Theme moved to App_Themes
* a link to the logged user's blog
*
* NoLogin.master: refactoring: Theme moved to App_Themes
* Circles.aspx: refactoring : circles now are given as select items
* Login.aspx: fixes the html presentation
* Register.aspx: Fixes a Typo
* Index.aspx: Implements a blog index, due to M&C changes with this
commit
* RemovePost.aspx: links to the new route to the "RemovePost" action,
giving it a post id
* RemoveTitle.aspx: fixes a not yet linked page to remove a post
collection under a given title
* EventPub.aspx: code refactoring
* Writting.ascx: cleans the code
* Web.config: fills the config with new names in the space
* Web.config: configures the new NpgsqlUserNameProvider
* Web.csproj: refactoring and others
* BlogEntryCollection.cs: implement the BlogEntryCollection
* BlogManager.cs: the manager helps to filter on access
* BlogProvider.cs: The title is not unique anymore, and one can modify
it, post a lot under it, drop all posts under it.
A Post is deleted by id.
* UUBlogEntryCollection.cs: implements a collection of post under a
given user name.
* UUTBlogEntryCollection.cs: implements a collection of post under a
given couple (user name, title).
* ListItem.cs: ListItem is declared obsolete in this model, helpers
can build MVC SelectListItem on data returned by the manager.
* LocalizedText.Designer.cs:
* LocalizedText.fr.Designer.cs: autogenerated from xml
* LocalizedText.resx:
* LocalizedText.fr.resx: new labels
* ChangeUserNameProvider.cs: xml doc
* Profile.cs: the UserName property is read only, and comes from
authentication, to change it, we set a Name and validate it agains
the "Profile" method
* UserManager.cs: simpler code a init time
* IContentProvider.cs: implements the new IDataProvider interface
* IDataProvider.cs: defines the new IDataProvider interface
* YavscModel.csproj: includes new classes
* UserPosts.aspx: adds a link to remove a post
* UserPost.aspx: now uses the new BlogEntryCollection object
9 years ago
|
|
|
if (!editsMyName)
|
|
|
|
if (!Roles.IsUserInRole ("Admin"))
|
|
|
|
if (!Roles.IsUserInRole ("FrontOffice"))
|
|
|
|
throw new UnauthorizedAccessException ("Your are not authorized to modify this profile");
|
|
|
|
|
|
|
|
if (AvatarFile != null) {
|
|
|
|
// if said valid, move as avatar file
|
|
|
|
// else invalidate the model
|
|
|
|
if (AvatarFile.ContentType == "image/png") {
|
|
|
|
string avdir = Server.MapPath (YavscHelpers.AvatarDir);
|
|
|
|
var di = new DirectoryInfo (avdir);
|
|
|
|
if (!di.Exists)
|
|
|
|
di.Create ();
|
* bg.gif:
* asc.gif:
* desc.gif:
* style.css: moved to App_Themes
* style.css:
* bg.gif:
* asc.gif:
* bg.png:
* rect.png:
* asc.png:
* desc.gif:
* jquery-ui.css:
* mdd_styles.css:
* croix.png:
* desc.png:
* style.css:
* jquery-ui.min.css:
* mdd_gripper.png:
* mdd_toolbar.png:
* jquery.timepicker.css:
* mdd_ajax_loader.gif:
* mdd_modal_background.png: moved to /App_Themes
* NpgsqlBlogProvider.cs: * Remove post by id
* Manage collections of entries on a couple (user,title), not a single
post
* NpgsqlCircleProvider.cs: Fixes the "Match" method.
* IDbModule.cs:
* Edit.aspx:
* Estimates.aspx:
* WorkFlowManager.cs:
* NpgsqlContentProvider.cs: refactoring
* NpgsqlMRPProviders.csproj: new NpgsqlUserName provider
* NpgsqlRoleProvider.cs: simpler init method
* NpgsqlUserNameProvider.cs: impements a UserNameProvider
* MyClass.cs: refactoring from Yavsc.Model
* BlogsController.cs: access control simplified
* FrontOfficeController.cs: Pdf generation made public ni case of
formatting exception
* mdd_styles.css: Theme -> App_Themes
* style.css: yet another style impact
* AccountController.cs: Fixes the user name modification
* BlogsController.cs: * Fixes the removal process
* On a title and user name, we get collection of posts, not only one.
* Implements an Access on circle
* FrontOfficeController.cs: * implements a new Get method.
* ensure a membership existence before delivering an estimate.
* GoogleController.cs: Fixes the user name modification on a Google
account
* ErrorHtmlFormatter.cs: nice error message in html (using Markdown
helper)
* FormatterException.cs: formatter exception exposes error and
standard output of the process
* TexToPdfFormatter.cs: * generates temporary files in the folder
returned by Path.GetTempPath()
* throws FormatterException
* Global.asax.cs: new route map:
Blogs/{action}/{user}/{title}
Blog/{user}/{title}
B/{id}
{controller}/{action}/{id}
* App.master: * refactoring: Theme moved to App_Themes
* a link to the logged user's blog
*
* NoLogin.master: refactoring: Theme moved to App_Themes
* Circles.aspx: refactoring : circles now are given as select items
* Login.aspx: fixes the html presentation
* Register.aspx: Fixes a Typo
* Index.aspx: Implements a blog index, due to M&C changes with this
commit
* RemovePost.aspx: links to the new route to the "RemovePost" action,
giving it a post id
* RemoveTitle.aspx: fixes a not yet linked page to remove a post
collection under a given title
* EventPub.aspx: code refactoring
* Writting.ascx: cleans the code
* Web.config: fills the config with new names in the space
* Web.config: configures the new NpgsqlUserNameProvider
* Web.csproj: refactoring and others
* BlogEntryCollection.cs: implement the BlogEntryCollection
* BlogManager.cs: the manager helps to filter on access
* BlogProvider.cs: The title is not unique anymore, and one can modify
it, post a lot under it, drop all posts under it.
A Post is deleted by id.
* UUBlogEntryCollection.cs: implements a collection of post under a
given user name.
* UUTBlogEntryCollection.cs: implements a collection of post under a
given couple (user name, title).
* ListItem.cs: ListItem is declared obsolete in this model, helpers
can build MVC SelectListItem on data returned by the manager.
* LocalizedText.Designer.cs:
* LocalizedText.fr.Designer.cs: autogenerated from xml
* LocalizedText.resx:
* LocalizedText.fr.resx: new labels
* ChangeUserNameProvider.cs: xml doc
* Profile.cs: the UserName property is read only, and comes from
authentication, to change it, we set a Name and validate it agains
the "Profile" method
* UserManager.cs: simpler code a init time
* IContentProvider.cs: implements the new IDataProvider interface
* IDataProvider.cs: defines the new IDataProvider interface
* YavscModel.csproj: includes new classes
* UserPosts.aspx: adds a link to remove a post
* UserPost.aspx: now uses the new BlogEntryCollection object
9 years ago
|
|
|
string avpath = Path.Combine (avdir, id + ".png");
|
|
|
|
AvatarFile.SaveAs (avpath);
|
|
|
|
model.avatar = Url.Content( YavscHelpers.AvatarDir + "/" + id + ".png");
|
|
|
|
} else
|
|
|
|
ModelState.AddModelError ("Avatar",
|
|
|
|
string.Format ("Image type {0} is not supported (suported formats : {1})",
|
|
|
|
AvatarFile.ContentType, "image/png"));
|
|
|
|
}
|
|
|
|
/* Sync the property in the Profile model to display :
|
|
|
|
* string cAvat = HttpContext.Profile.GetPropertyValue ("Avatar") as string;
|
|
|
|
if (cAvat != null) if (model.avatar == null) model.avatar = cAvat;
|
|
|
|
*/
|
|
|
|
if (ModelState.IsValid) {
|
* bg.gif:
* asc.gif:
* desc.gif:
* style.css: moved to App_Themes
* style.css:
* bg.gif:
* asc.gif:
* bg.png:
* rect.png:
* asc.png:
* desc.gif:
* jquery-ui.css:
* mdd_styles.css:
* croix.png:
* desc.png:
* style.css:
* jquery-ui.min.css:
* mdd_gripper.png:
* mdd_toolbar.png:
* jquery.timepicker.css:
* mdd_ajax_loader.gif:
* mdd_modal_background.png: moved to /App_Themes
* NpgsqlBlogProvider.cs: * Remove post by id
* Manage collections of entries on a couple (user,title), not a single
post
* NpgsqlCircleProvider.cs: Fixes the "Match" method.
* IDbModule.cs:
* Edit.aspx:
* Estimates.aspx:
* WorkFlowManager.cs:
* NpgsqlContentProvider.cs: refactoring
* NpgsqlMRPProviders.csproj: new NpgsqlUserName provider
* NpgsqlRoleProvider.cs: simpler init method
* NpgsqlUserNameProvider.cs: impements a UserNameProvider
* MyClass.cs: refactoring from Yavsc.Model
* BlogsController.cs: access control simplified
* FrontOfficeController.cs: Pdf generation made public ni case of
formatting exception
* mdd_styles.css: Theme -> App_Themes
* style.css: yet another style impact
* AccountController.cs: Fixes the user name modification
* BlogsController.cs: * Fixes the removal process
* On a title and user name, we get collection of posts, not only one.
* Implements an Access on circle
* FrontOfficeController.cs: * implements a new Get method.
* ensure a membership existence before delivering an estimate.
* GoogleController.cs: Fixes the user name modification on a Google
account
* ErrorHtmlFormatter.cs: nice error message in html (using Markdown
helper)
* FormatterException.cs: formatter exception exposes error and
standard output of the process
* TexToPdfFormatter.cs: * generates temporary files in the folder
returned by Path.GetTempPath()
* throws FormatterException
* Global.asax.cs: new route map:
Blogs/{action}/{user}/{title}
Blog/{user}/{title}
B/{id}
{controller}/{action}/{id}
* App.master: * refactoring: Theme moved to App_Themes
* a link to the logged user's blog
*
* NoLogin.master: refactoring: Theme moved to App_Themes
* Circles.aspx: refactoring : circles now are given as select items
* Login.aspx: fixes the html presentation
* Register.aspx: Fixes a Typo
* Index.aspx: Implements a blog index, due to M&C changes with this
commit
* RemovePost.aspx: links to the new route to the "RemovePost" action,
giving it a post id
* RemoveTitle.aspx: fixes a not yet linked page to remove a post
collection under a given title
* EventPub.aspx: code refactoring
* Writting.ascx: cleans the code
* Web.config: fills the config with new names in the space
* Web.config: configures the new NpgsqlUserNameProvider
* Web.csproj: refactoring and others
* BlogEntryCollection.cs: implement the BlogEntryCollection
* BlogManager.cs: the manager helps to filter on access
* BlogProvider.cs: The title is not unique anymore, and one can modify
it, post a lot under it, drop all posts under it.
A Post is deleted by id.
* UUBlogEntryCollection.cs: implements a collection of post under a
given user name.
* UUTBlogEntryCollection.cs: implements a collection of post under a
given couple (user name, title).
* ListItem.cs: ListItem is declared obsolete in this model, helpers
can build MVC SelectListItem on data returned by the manager.
* LocalizedText.Designer.cs:
* LocalizedText.fr.Designer.cs: autogenerated from xml
* LocalizedText.resx:
* LocalizedText.fr.resx: new labels
* ChangeUserNameProvider.cs: xml doc
* Profile.cs: the UserName property is read only, and comes from
authentication, to change it, we set a Name and validate it agains
the "Profile" method
* UserManager.cs: simpler code a init time
* IContentProvider.cs: implements the new IDataProvider interface
* IDataProvider.cs: defines the new IDataProvider interface
* YavscModel.csproj: includes new classes
* UserPosts.aspx: adds a link to remove a post
* UserPost.aspx: now uses the new BlogEntryCollection object
9 years ago
|
|
|
ProfileBase prf = ProfileBase .Create (id);
|
|
|
|
prf.SetPropertyValue ("Name", model.Name);
|
|
|
|
prf.SetPropertyValue ("BlogVisible", model.BlogVisible);
|
|
|
|
prf.SetPropertyValue ("BlogTitle", model.BlogTitle);
|
|
|
|
if (AvatarFile != null) {
|
|
|
|
prf.SetPropertyValue ("Avatar", model.avatar);
|
|
|
|
} else {
|
|
|
|
var av = prf.GetPropertyValue ("Avatar");
|
|
|
|
if (av != null)
|
|
|
|
model.avatar = av as string;
|
|
|
|
}
|
|
|
|
prf.SetPropertyValue ("Address", model.Address);
|
|
|
|
prf.SetPropertyValue ("CityAndState", model.CityAndState);
|
|
|
|
prf.SetPropertyValue ("Country", model.Country);
|
|
|
|
prf.SetPropertyValue ("ZipCode", model.ZipCode);
|
|
|
|
prf.SetPropertyValue ("WebSite", model.WebSite);
|
|
|
|
prf.SetPropertyValue ("Name", model.Name);
|
|
|
|
prf.SetPropertyValue ("Phone", model.Phone);
|
|
|
|
prf.SetPropertyValue ("Mobile", model.Mobile);
|
|
|
|
prf.SetPropertyValue ("BankCode", model.BankCode);
|
|
|
|
prf.SetPropertyValue ("IBAN", model.IBAN);
|
|
|
|
prf.SetPropertyValue ("BIC", model.BIC);
|
|
|
|
prf.SetPropertyValue ("WicketCode", model.WicketCode);
|
|
|
|
prf.SetPropertyValue ("AccountNumber", model.AccountNumber);
|
|
|
|
prf.SetPropertyValue ("BankedKey", model.BankedKey);
|
|
|
|
prf.SetPropertyValue ("gcalid", model.GoogleCalendar);
|
|
|
|
prf.Save ();
|
|
|
|
|
* bg.gif:
* asc.gif:
* desc.gif:
* style.css: moved to App_Themes
* style.css:
* bg.gif:
* asc.gif:
* bg.png:
* rect.png:
* asc.png:
* desc.gif:
* jquery-ui.css:
* mdd_styles.css:
* croix.png:
* desc.png:
* style.css:
* jquery-ui.min.css:
* mdd_gripper.png:
* mdd_toolbar.png:
* jquery.timepicker.css:
* mdd_ajax_loader.gif:
* mdd_modal_background.png: moved to /App_Themes
* NpgsqlBlogProvider.cs: * Remove post by id
* Manage collections of entries on a couple (user,title), not a single
post
* NpgsqlCircleProvider.cs: Fixes the "Match" method.
* IDbModule.cs:
* Edit.aspx:
* Estimates.aspx:
* WorkFlowManager.cs:
* NpgsqlContentProvider.cs: refactoring
* NpgsqlMRPProviders.csproj: new NpgsqlUserName provider
* NpgsqlRoleProvider.cs: simpler init method
* NpgsqlUserNameProvider.cs: impements a UserNameProvider
* MyClass.cs: refactoring from Yavsc.Model
* BlogsController.cs: access control simplified
* FrontOfficeController.cs: Pdf generation made public ni case of
formatting exception
* mdd_styles.css: Theme -> App_Themes
* style.css: yet another style impact
* AccountController.cs: Fixes the user name modification
* BlogsController.cs: * Fixes the removal process
* On a title and user name, we get collection of posts, not only one.
* Implements an Access on circle
* FrontOfficeController.cs: * implements a new Get method.
* ensure a membership existence before delivering an estimate.
* GoogleController.cs: Fixes the user name modification on a Google
account
* ErrorHtmlFormatter.cs: nice error message in html (using Markdown
helper)
* FormatterException.cs: formatter exception exposes error and
standard output of the process
* TexToPdfFormatter.cs: * generates temporary files in the folder
returned by Path.GetTempPath()
* throws FormatterException
* Global.asax.cs: new route map:
Blogs/{action}/{user}/{title}
Blog/{user}/{title}
B/{id}
{controller}/{action}/{id}
* App.master: * refactoring: Theme moved to App_Themes
* a link to the logged user's blog
*
* NoLogin.master: refactoring: Theme moved to App_Themes
* Circles.aspx: refactoring : circles now are given as select items
* Login.aspx: fixes the html presentation
* Register.aspx: Fixes a Typo
* Index.aspx: Implements a blog index, due to M&C changes with this
commit
* RemovePost.aspx: links to the new route to the "RemovePost" action,
giving it a post id
* RemoveTitle.aspx: fixes a not yet linked page to remove a post
collection under a given title
* EventPub.aspx: code refactoring
* Writting.ascx: cleans the code
* Web.config: fills the config with new names in the space
* Web.config: configures the new NpgsqlUserNameProvider
* Web.csproj: refactoring and others
* BlogEntryCollection.cs: implement the BlogEntryCollection
* BlogManager.cs: the manager helps to filter on access
* BlogProvider.cs: The title is not unique anymore, and one can modify
it, post a lot under it, drop all posts under it.
A Post is deleted by id.
* UUBlogEntryCollection.cs: implements a collection of post under a
given user name.
* UUTBlogEntryCollection.cs: implements a collection of post under a
given couple (user name, title).
* ListItem.cs: ListItem is declared obsolete in this model, helpers
can build MVC SelectListItem on data returned by the manager.
* LocalizedText.Designer.cs:
* LocalizedText.fr.Designer.cs: autogenerated from xml
* LocalizedText.resx:
* LocalizedText.fr.resx: new labels
* ChangeUserNameProvider.cs: xml doc
* Profile.cs: the UserName property is read only, and comes from
authentication, to change it, we set a Name and validate it agains
the "Profile" method
* UserManager.cs: simpler code a init time
* IContentProvider.cs: implements the new IDataProvider interface
* IDataProvider.cs: defines the new IDataProvider interface
* YavscModel.csproj: includes new classes
* UserPosts.aspx: adds a link to remove a post
* UserPost.aspx: now uses the new BlogEntryCollection object
9 years ago
|
|
|
if (editsMyName) {
|
|
|
|
UserManager.ChangeName (id, model.Name);
|
|
|
|
FormsAuthentication.SetAuthCookie (model.Name, model.RememberMe);
|
|
|
|
}
|
|
|
|
ViewData ["Message"] = "Profile enregistré"+((editsMyName)?", nom public inclu.":"");
|
|
|
|
}
|
|
|
|
return View (model);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// Circles this instance.
|
|
|
|
/// </summary>
|
|
|
|
[Authorize]
|
|
|
|
public ActionResult Circles ()
|
|
|
|
{
|
|
|
|
string user = Membership.GetUser ().UserName;
|
|
|
|
ViewData["Circles"] = CircleManager.DefaultProvider.List (user);
|
|
|
|
return View ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Logout the specified returnUrl.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="returnUrl">Return URL.</param>
|
|
|
|
[Authorize]
|
|
|
|
public ActionResult Logout (string returnUrl)
|
|
|
|
{
|
|
|
|
FormsAuthentication.SignOut ();
|
|
|
|
return Redirect (returnUrl);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Losts the password.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>The password.</returns>
|
|
|
|
/// <param name="model">Model.</param>
|
|
|
|
public ActionResult ResetPassword(LostPasswordModel model)
|
|
|
|
{
|
|
|
|
if (Request.HttpMethod == "POST") {
|
|
|
|
StringDictionary errors;
|
|
|
|
MembershipUser user;
|
|
|
|
YavscHelpers.ValidatePasswordReset (model, out errors, out user);
|
|
|
|
foreach (string key in errors.Keys)
|
|
|
|
ModelState.AddModelError (key, errors [key]);
|
|
|
|
|
|
|
|
if (user != null && ModelState.IsValid)
|
|
|
|
Url.SendActivationMessage (user);
|
|
|
|
}
|
|
|
|
return View (model);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Validate the specified id and key.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id">Identifier.</param>
|
|
|
|
/// <param name="key">Key.</param>
|
|
|
|
[HttpGet]
|
|
|
|
public ActionResult Validate (string id, string key)
|
|
|
|
{
|
|
|
|
MembershipUser u = Membership.GetUser (id, false);
|
|
|
|
if (u == null) {
|
|
|
|
ViewData ["Error"] =
|
|
|
|
string.Format ("Cet utilisateur n'existe pas ({0})", id);
|
|
|
|
} else if (u.ProviderUserKey.ToString () == key) {
|
|
|
|
if (u.IsApproved) {
|
|
|
|
ViewData ["Message"] =
|
|
|
|
string.Format ("Votre compte ({0}) est déjà validé.", id);
|
|
|
|
} else {
|
|
|
|
u.IsApproved = true;
|
|
|
|
Membership.UpdateUser (u);
|
|
|
|
ViewData ["Message"] =
|
|
|
|
string.Format ("La création de votre compte ({0}) est validée.", id);
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
ViewData ["Error"] = "La clé utilisée pour valider ce compte est incorrecte";
|
|
|
|
return View ();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|