* AccountController.cs: Register and reset passord

from Web API

* GCMController.cs: initial creation, will host GCM calls and related
  procedures.

* ResetPassword.aspx: Html view to reset the password

* LocalizedText.resx:
* LocalizedText.fr.resx: new String form circles

* Web.config:
* Web.csproj:
* YavscModel.csproj:
* LocalizedText.Designer.cs:
* Profile.cs:
* Profile.cs:
* LocalizedText.fr.Designer.cs:
* LoginModel.cs:
* Publishing.cs:
* CalendarController.cs:
* LoginModel.cs:
* GCMRegister.cs:
* Publishing.cs:
* GCMRegister.cs:
* NewRoleModel.cs:
* NewRoleModel.cs:
* RegisterModel.cs:
* NewAdminModel.cs:
* RegisterModel.cs:
* NewAdminModel.cs:
* LostPasswordModel.cs:
* RegisterViewModel.cs:
* RegisterViewModel.cs:
* ProviderPublicInfo.cs:
* RegisterClientModel.cs:
* ChangePasswordModel.cs:
* ProviderPublicInfo.cs:
* RegisterClientModel.cs:
* ChangePasswordModel.cs: Fixes a typo (in the namespace :-/)

* NpgsqlCircleProvider.cs: Fixes the Circle creation

* Global.asax.cs:
* AdminController.cs:
* NpgsqlContentProvider.cs: code formatting

* BlogsController.cs:
* CircleController.cs:
* WorkFlowController.cs:
* PaypalApiController.cs:
* FrontOfficeController.cs: refactoring

* AccountController.cs: Adds the way to reset the password

* FrontOfficeController.cs: xml doc

* T.cs: Make this class an helper to translation

* YavscHelpers.cs: Implements the e-mail sending

* style.css: style uniformization

* Circles.aspx: Implements the Html interface to Circle creation
  (modifications and deletions are still to implement)

* Register.ascx: Allows the error display in case of lack of power of
  the user at registering another user.

* Estimate.aspx: use the partial view to register from the Account
  folder.
Cleans the useless reference to ~/Theme/dark/style.css, that was for
  using the "tablesorter.js", no used anymore.

* Web.config: Trying to have all the Index pages to work...
This commit is contained in:
Paul Schneider 2015-06-18 11:02:23 +02:00
commit 53930befd3
44 changed files with 705 additions and 135 deletions

View file

@ -12,6 +12,7 @@ using Yavsc.Model.RolesAndMembers;
using Yavsc.Helpers;
using System.Web.Mvc;
using Yavsc.Model.Circles;
using System.Collections.Specialized;
namespace Yavsc.Controllers
{
@ -108,7 +109,7 @@ namespace Yavsc.Controllers
"déjà enregistré");
return View (model);
case MembershipCreateStatus.Success:
YavscHelpers.SendActivationEmail (user);
YavscHelpers.SendActivationMessage (user);
ViewData ["username"] = user.UserName;
ViewData ["email"] = user.Email;
return View ("RegistrationPending");
@ -177,8 +178,8 @@ namespace Yavsc.Controllers
// than return false in certain failure scenarios.
bool changePasswordSucceeded = false;
try {
var users = Membership.FindUsersByName (model.Username);
MembershipUserCollection users =
Membership.FindUsersByName (model.Username);
if (users.Count > 0) {
MembershipUser user = Membership.GetUser (model.Username, true);
@ -299,6 +300,8 @@ namespace Yavsc.Controllers
{
string user = Membership.GetUser ().UserName;
CircleInfoCollection cic = CircleManager.DefaultProvider.List (user);
if (cic == null)
cic = new CircleInfoCollection ();
return View (cic);
}
/// <summary>
@ -312,6 +315,22 @@ namespace Yavsc.Controllers
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;
YavscHelpers.ResetPassword (model, out errors);
foreach (string key in errors.Keys)
ModelState.AddModelError (key, errors [key]);
}
return View (model);
}
/// <summary>
/// Validate the specified id and key.
/// </summary>
@ -325,13 +344,19 @@ namespace Yavsc.Controllers
ViewData ["Error"] =
string.Format ("Cet utilisateur n'existe pas ({0})", id);
} else if (u.ProviderUserKey.ToString () == key) {
u.IsApproved = true;
Membership.UpdateUser (u);
ViewData ["Message"] =
string.Format ("La création de votre compte ({0}) est validée.", id);
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 ();
}
}
}

View file

@ -260,7 +260,6 @@ namespace Yavsc.Controllers
[Authorize()]
public ActionResult Admin (NewAdminModel model)
{
// ASSERT (Roles.RoleExists (adminRoleName))
string [] admins = Roles.GetUsersInRole (adminRoleName);
string currentUser = Membership.GetUser ().UserName;

View file

@ -44,6 +44,11 @@ namespace Yavsc.Controllers
{
return View ();
}
/// <summary>
/// Pub the Event
/// </summary>
/// <returns>The pub.</returns>
/// <param name="model">Model.</param>
public ActionResult EventPub (EventPub model)
{
return View (model);