* 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...
vnext
Paul Schneider 9 years ago
parent 597b674b74
commit 53930befd3
44 changed files with 705 additions and 135 deletions

@ -1,3 +1,9 @@
2015-06-18 Paul Schneider <paul@pschneider.fr>
* NpgsqlCircleProvider.cs: Fixes the Circle creation
* NpgsqlContentProvider.cs: code formatting
2015-06-10 Paul Schneider <paul@pschneider.fr>
* NpgsqlCircleProvider.cs:

@ -25,6 +25,7 @@ using System.Configuration;
using Npgsql;
using NpgsqlTypes;
using System.Collections.Generic;
using System.Web.Security;
namespace WorkFlowProvider
{
@ -140,7 +141,7 @@ namespace WorkFlowProvider
cmd.Parameters.AddWithValue ("wnr", owner);
cmd.Parameters.AddWithValue ("tit", title);
cmd.Parameters.AddWithValue ("app", applicationName);
id = (long)cmd.ExecuteScalar ();
id = (long) cmd.ExecuteScalar ();
}
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "insert into circle_members (circle_id,member) values (@cid,@mbr)";
@ -148,14 +149,14 @@ namespace WorkFlowProvider
cmd.Parameters.Add ("mbr", NpgsqlDbType.Varchar);
cmd.Prepare ();
foreach (string user in users) {
cmd.Parameters[1].Value = user;
object pkid = Membership.GetUser (user).ProviderUserKey;
cmd.Parameters[1].Value = pkid.ToString();
cmd.ExecuteNonQuery ();
}
}
cnx.Close ();
}
throw new NotImplementedException ();
return id;
}
/// <summary>
@ -190,11 +191,15 @@ namespace WorkFlowProvider
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
if (rdr.HasRows) {
cc = new CircleInfoCollection ();
while (rdr.Read ())
cc.Add(
new CircleInfo (
rdr.GetInt64 (0),
rdr.GetString (1)));
while (rdr.Read ()) {
string title = null;
int ottl = rdr.GetOrdinal ("title");
if (!rdr.IsDBNull (ottl))
title = rdr.GetString (ottl);
long id = (long) rdr.GetInt64 (
rdr.GetOrdinal ("_id"));
cc.Add (new CircleInfo (id,title));
}
}
rdr.Close ();
}

@ -538,7 +538,7 @@ namespace Yavsc
cmd.Parameters.AddWithValue("@app", ApplicationName);
cnx.Open ();
Estimate created = new Estimate ();
created.Id = (long)cmd.ExecuteScalar ();
created.Id = (long) cmd.ExecuteScalar ();
cnx.Close ();
created.Title = title;
created.Description = description;

@ -0,0 +1,111 @@
//
// AccountController.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.Net.Http;
using Yavsc.Model.RolesAndMembers;
using System.Web.Security;
using System.Web.Profile;
using Yavsc.Helpers;
using System.Collections.Specialized;
namespace Yavsc.ApiControllers
{
public class AccountController : ApiController
{
/// <summary>
/// Register the specified model.
/// </summary>
/// <param name="model">Model.</param>
[Authorize()]
[ValidateAjaxAttribute]
public HttpResponseMessage Register ([FromBody] RegisterClientModel model)
{
if (ModelState.IsValid) {
if (model.IsApprouved)
if (!Roles.IsUserInRole ("Admin"))
if (!Roles.IsUserInRole ("FrontOffice")) {
ModelState.AddModelError ("Register",
"Since you're not member of Admin or FrontOffice groups, " +
"you cannot ask for a pre-approuved registration");
return DefaultResponse ();
}
MembershipCreateStatus mcs;
var user = Membership.CreateUser (
model.UserName,
model.Password,
model.Email,
null,
null,
model.IsApprouved,
out mcs);
switch (mcs) {
case MembershipCreateStatus.DuplicateEmail:
ModelState.AddModelError ("Email", "Cette adresse e-mail correspond " +
"à un compte utilisateur existant");
break;
case MembershipCreateStatus.DuplicateUserName:
ModelState.AddModelError ("UserName", "Ce nom d'utilisateur est " +
"déjà enregistré");
break;
case MembershipCreateStatus.Success:
if (!model.IsApprouved)
YavscHelpers.SendActivationMessage (user);
ProfileBase prtu = ProfileBase.Create (model.UserName);
prtu.SetPropertyValue("Name",model.Name);
prtu.SetPropertyValue("Address",model.Address);
prtu.SetPropertyValue("CityAndState",model.CityAndState);
prtu.SetPropertyValue("Mobile",model.Mobile);
prtu.SetPropertyValue("Phone",model.Phone);
prtu.SetPropertyValue("ZipCode",model.ZipCode);
break;
default:
break;
}
}
return DefaultResponse ();
}
private HttpResponseMessage DefaultResponse()
{
return ModelState.IsValid ?
Request.CreateResponse (System.Net.HttpStatusCode.OK) :
Request.CreateResponse (System.Net.HttpStatusCode.BadRequest,
ValidateAjaxAttribute.GetErrorModelObject (ModelState));
}
/// <summary>
/// Resets the password.
/// </summary>
/// <param name="model">Model.</param>
[ValidateAjax]
public void ResetPassword(LostPasswordModel model)
{
StringDictionary errors;
YavscHelpers.ResetPassword (model, out errors);
foreach (string key in errors.Keys)
ModelState.AddModelError (key, errors [key]);
}
}
}

@ -12,7 +12,7 @@ namespace Yavsc.ApiControllers
/// <summary>
/// Blogs API controller.
/// </summary>
public class BlogsApiController : ApiController
public class BlogsController : ApiController
{
private const string adminRoleName = "Admin";

@ -34,7 +34,7 @@ namespace Yavsc.ApiControllers
/// <summary>
/// Night flash controller.
/// </summary>
public class CalendarApiController: ApiController
public class CalendarController: ApiController
{
YaEvent[] getTestList()
{
@ -160,7 +160,7 @@ namespace Yavsc.ApiControllers
"déjà enregistré");
break;
case MembershipCreateStatus.Success:
YavscHelpers.SendActivationEmail (user);
YavscHelpers.SendActivationMessage (user);
// TODO set registration id
throw new NotImplementedException ();
}

@ -27,10 +27,15 @@ using System.Web.Security;
namespace Yavsc.ApiControllers
{
public class NewCircle {
public string title { get ; set; }
public string [] users { get ; set; }
}
/// <summary>
/// Circle controller.
/// </summary>
public class CircleApiController : ApiController
public class CircleController : ApiController
{
/// <summary>
/// Creates the specified circle using the given title and user list.
@ -38,10 +43,10 @@ namespace Yavsc.ApiControllers
/// <param name="title">Identifier.</param>
/// <param name="users">Users.</param>
[Authorize]
public long Create(string title, string [] users)
public long Create(NewCircle model)
{
string user = Membership.GetUser ().UserName;
return CircleManager.DefaultProvider.Create (user, title, users);
return CircleManager.DefaultProvider.Create (user, model.title, model.users);
}
/// <summary>

@ -164,66 +164,6 @@ namespace Yavsc.ApiControllers
return result;
}
private HttpResponseMessage DefaultResponse()
{
return ModelState.IsValid ?
Request.CreateResponse (System.Net.HttpStatusCode.OK) :
Request.CreateResponse (System.Net.HttpStatusCode.BadRequest,
ValidateAjaxAttribute.GetErrorModelObject (ModelState));
}
/// <summary>
/// Register the specified model.
/// </summary>
/// <param name="model">Model.</param>
[Authorize()]
[ValidateAjaxAttribute]
public HttpResponseMessage Register ([FromBody] RegisterClientModel model)
{
if (ModelState.IsValid) {
if (model.IsApprouved)
if (!Roles.IsUserInRole ("Admin"))
if (!Roles.IsUserInRole ("FrontOffice")) {
ModelState.AddModelError ("Register",
"Since you're not member of Admin or FrontOffice groups, " +
"you cannot ask for a pre-approuved registration");
return DefaultResponse ();
}
MembershipCreateStatus mcs;
var user = Membership.CreateUser (
model.UserName,
model.Password,
model.Email,
null,
null,
model.IsApprouved,
out mcs);
switch (mcs) {
case MembershipCreateStatus.DuplicateEmail:
ModelState.AddModelError ("Email", "Cette adresse e-mail correspond " +
"à un compte utilisateur existant");
break;
case MembershipCreateStatus.DuplicateUserName:
ModelState.AddModelError ("UserName", "Ce nom d'utilisateur est " +
"déjà enregistré");
break;
case MembershipCreateStatus.Success:
if (!model.IsApprouved)
Yavsc.Helpers.YavscHelpers.SendActivationEmail (user);
ProfileBase prtu = ProfileBase.Create (model.UserName);
prtu.SetPropertyValue("Name",model.Name);
prtu.SetPropertyValue("Address",model.Address);
prtu.SetPropertyValue("CityAndState",model.CityAndState);
prtu.SetPropertyValue("Mobile",model.Mobile);
prtu.SetPropertyValue("Phone",model.Phone);
prtu.SetPropertyValue("ZipCode",model.ZipCode);
break;
default:
break;
}
}
return DefaultResponse ();
}
}
}

@ -0,0 +1,33 @@
//
// GCMController.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
namespace Yavsc.ApiControllers
{
public class GCMController : ApiController
{
public GCMController ()
{
}
}
}

@ -21,7 +21,7 @@
using System;
using System.Web.Http;
#if HASPAYPALAPI
#if USEPAYPALAPI
using PayPal.Api;

@ -85,7 +85,7 @@ namespace Yavsc.ApiControllers
return ;
case MembershipCreateStatus.Success:
if (!userModel.IsApprouved)
YavscHelpers.SendActivationEmail (user);
YavscHelpers.SendActivationMessage (user);
return;
default:
throw new InvalidOperationException (string.Format("Unexpected user creation code :{0}",mcs));

@ -1,3 +1,51 @@
2015-06-18 Paul Schneider <paul@pschneider.fr>
* 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 resetr the password
* BlogsController.cs:
* CircleController.cs:
* WorkFlowController.cs:
* PaypalApiController.cs:
* FrontOfficeController.cs: refactoring
* Web.config:
* Web.csproj:
* CalendarController.cs:
* AccountController.cs: Adds the way to reset the password
* Global.asax.cs:
* AdminController.cs: code formatting
* 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...
2015-06-12 Paul Schneider <paul@pschneider.fr>
* AccountController.cs: Code formatting

@ -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 ();
}
}
}

@ -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;

@ -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);

@ -1,5 +1,4 @@

using System;
using System.Collections.Generic;
using System.Linq;
@ -108,6 +107,8 @@ namespace Yavsc
("AppStartExecuteCompleted",
BindingFlags.NonPublic | BindingFlags.Static);
ob.SetValue(null, true, null);
}
}
}

@ -15,8 +15,9 @@ namespace Yavsc.Helpers
/// <summary>
/// T.
/// </summary>
public class T
public static class T
{
/// <summary>
/// Gets the string.
/// </summary>
@ -27,5 +28,12 @@ namespace Yavsc.Helpers
string tr = LocalizedText.ResourceManager.GetString (msg.Replace (" ", "_"));
return tr==null?msg:tr;
}
public static string Translate(this HtmlHelper helper, string text)
{
// Just call the other one, to avoid having two copies (we don't use the HtmlHelper).
return GetString(text);
}
}
}

@ -5,6 +5,10 @@ using System.Web.Security;
using System.IO;
using System.Web.Configuration;
using System.Net.Mail;
using System.Web.Http.ModelBinding;
using Yavsc.Model.RolesAndMembers;
using System.Collections.Generic;
using System.Collections.Specialized;
namespace Yavsc.Helpers
{
@ -13,8 +17,7 @@ namespace Yavsc.Helpers
/// </summary>
public static class YavscHelpers
{
private static string registrationMessage =
WebConfigurationManager.AppSettings ["RegistrationMessage"];
private static string siteName = null;
@ -43,10 +46,21 @@ namespace Yavsc.Helpers
}
/// <summary>
/// Sends the activation email.
/// Sends the activation message.
/// </summary>
/// <param name="user">User.</param>
public static void SendActivationEmail(MembershipUser user) {
public static void SendActivationMessage(MembershipUser user)
{
SendEmail (WebConfigurationManager.AppSettings ["RegistrationMessage"],
user);
}
/// <summary>
/// Sends the email.
/// </summary>
/// <param name="registrationMessage">Registration message.</param>
/// <param name="user">User.</param>
public static void SendEmail(string registrationMessage, MembershipUser user) {
FileInfo fi = new FileInfo (
HttpContext.Current.Server.MapPath (registrationMessage));
if (!fi.Exists) {
@ -79,6 +93,48 @@ namespace Yavsc.Helpers
}
}
/// <summary>
/// Resets the password.
/// </summary>
/// <param name="modelState">Model state.</param>
/// <param name="model">Model.</param>
public static void ResetPassword(LostPasswordModel model, out StringDictionary errors)
{
MembershipUserCollection users = null;
errors = new StringDictionary ();
if (!string.IsNullOrEmpty (model.UserName)) {
users =
Membership.FindUsersByName (model.UserName);
if (users.Count < 1) {
errors.Add ("UserName", "User name not found");
return ;
}
if (users.Count != 1) {
errors.Add ("UserName", "Found more than one user!(sic)");
return ;
}
}
if (!string.IsNullOrEmpty (model.Email)) {
users =
Membership.FindUsersByEmail (model.Email);
if (users.Count < 1) {
errors.Add ( "Email", "Email not found");
return ;
}
if (users.Count != 1) {
errors.Add ("Email", "Found more than one user!(sic)");
return ;
}
}
if (users==null)
return;
// Assert users.Count == 1
if (users.Count != 1)
throw new InvalidProgramException ("Emails and user's names are uniques, and we find more than one result here, aborting.");
foreach (MembershipUser u in users)
YavscHelpers.SendActivationMessage (u);
}
}
}

@ -145,7 +145,7 @@ padding-left: 20px;
}
input.actionlink, a.actionlink {
.actionlink {
color: #B0B080;
border: solid 1px rgb(128,128,128);
border-radius:5px;
@ -155,9 +155,17 @@ input.actionlink, a.actionlink {
font-family: 'Arial', cursive;
}
input, select {
color: #B0B080;
border: solid 1px rgb(128,128,128);
border-radius:5px;
background-color:rgba(0,0,32,0.8);
font-family: 'Arial', cursive;
}
a.actionlink img { top:4px; }
input.actionlink:hover, a.actionlink:hover {
.actionlink:hover {
background-color:rgba(30,0,124,0.9);
border : solid 1px white;
text-decoration: underline;

@ -1,18 +1,179 @@
<%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage<Yavsc.Model.Circles.CircleInfoCollection>" %>
<asp:Content ID="initContent" ContentPlaceHolderID="init" runat="server">
</asp:Content>
<%@ Page Title="Circles" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage<Yavsc.Model.Circles.CircleInfoCollection>" %>
<%@ Register Assembly="Yavsc.WebControls" TagPrefix="yavsc" Namespace="Yavsc.WebControls" %>
<asp:Content ID="headContent" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript" src="<%=Url.Content("~/Scripts/stupidtable.js")%>"></script>
</asp:Content>
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
<% if (Model==null) { %>
No circle yet
<% } else { %>
<% foreach (CircleInfo ci in Model) { %>
<%= ci.Title %>
<%= ci.Id %>
<br/>
<% }} %>
<table id="tbc">
<thead>
<tr>
<th data-sort="string"><%=Html.Translate("Title")%></th>
</tr>
</thead>
<tbody id="tbcb">
<% int lc=0;
foreach (CircleInfo ci in Model) { lc++; %>
<tr class="<%= (ci.Id%2==0)?"even ":"odd " %>row" id="c_<%=ci.Id%>">
<td><%=ci.Title%></td>
<td>
<input type="button" value="<%=Html.Translate("Remove")%>" class="actionlink rowbtnrm"/>
<input type="button" value="<%=Html.Translate("Members")%>" class="actionlink rowbtnvw"/>
</td>
</tr>
<% } %>
</tbody>
</table>
<script>
$(function(){
$("#tbc").stupidtable();
});
</script>
</asp:Content>
<asp:Content ID="MASContentContent" ContentPlaceHolderID="MASContent" runat="server">
<div id="dfnuser" class="hidden panel">
<%= Html.Partial("~/Views/Account/Register.ascx",new RegisterClientModel(),new ViewDataDictionary(ViewData)
{
TemplateInfo = new System.Web.Mvc.TemplateInfo
{
HtmlFieldPrefix = ViewData.TemplateInfo.HtmlFieldPrefix==""?"ur":ViewData.TemplateInfo.HtmlFieldPrefix+"_ur"
}
}) %>
</div>
<form>
<fieldset>
<legend>Nouveau cercle</legend>
<span id="msg" class="field-validation-valid error"></span>
<label for="title"><b><%=Html.Translate("Title")%></b></label>
<input type="text" id="title" name="title" class="inputtext"/>
<span id="Err_cr_title" class="field-validation-valid error"></span>
<table id="tbmbrs">
<thead>
<tr>
<th data-sort="string"><%=Html.Translate("Members")%>
<span id="Err_cr_users" class="field-validation-valid error"></span>
<yavsc:InputUserName
id="users"
name="users"
emptyvalue="[nouvel utilisateur]"
onchange="onmembersChange(this.value);"
multiple="true"
runat="server" >
</yavsc:InputUserName>
<script>
function message(msg) {
if (msg) {
$("#msg").removeClass("hidden");
$("#msg").text(msg);
} else { $("#msg").addClass("hidden"); } }
function onmembersChange(newval)
{
if (newval=='')
$("#dfnuser").removeClass("hidden");
else
$("#dfnuser").addClass("hidden");
}
function clearRegistrationValidation(){
$("#Err_ur_Name").text("");
$("#Err_ur_UserName").text("");
$("#Err_ur_Mobile").text("");
$("#Err_ur_Phone").text("");
$("#Err_ur_Email").text("");
$("#Err_ur_Address").text("");
$("#Err_ur_ZipCode").text("");
$("#Err_ur_CityAndState").text("");
$("#Err_ur_IsApprouved").text("");
}
function clearCircleValidation() {}
function addCircle()
{
var circle = { title: $("#title").val(), users: $("#users").val() } ;
$("#title").text('');
$("#users").val('');
$.ajax({
url: "<%=Url.Content("~/api/Circle/Create")%>",
type: "POST",
data: circle,
success: function (data) {
$("#users option:last").after($('<option>'+user.UserName+'</option>'));
},
statusCode: {
400: function(data) {
$.each(data.responseJSON, function (key, value) {
var errspanid = "Err_cr_" + value.key.replace("model.","");
var errspan = document.getElementById(errspanid);
if (errspan==null)
alert('enoent '+errspanid);
else
errspan.innerHTML=value.errors.join("<br/>");
});
}
},
error: function (xhr, ajaxOptions, thrownError) {
if (xhr.status!=400)
message(xhr.status+" : "+xhr.responseText);
else message(false);
}});
}
function addUser()
{
var user={
UserName: $("#ur_UserName").val(),
Name: $("#ur_Name").val(),
Password: $("#ur_Password").val(),
Email: $("#ur_Email").val(),
Address: $("#ur_Address").val(),
CityAndState: $("#ur_CityAndState").val(),
ZipCode: $("#ur_ZipCode").val(),
Phone: $("#ur_Phone").val(),
Mobile: $("#ur_Mobile").val(),
IsApprouved: true
};
clearRegistrationValidation();
$.ajax({
url: "<%=Url.Content("~/api/FrontOffice/Register")%>",
type: "POST",
data: user,
success: function (data) {
$("#users option:last").after($('<option>'+user.UserName+'</option>'));
},
statusCode: {
400: function(data) {
$.each(data.responseJSON, function (key, value) {
var errspanid = "Err_ur_" + value.key.replace("model.","");
var errspan = document.getElementById(errspanid);
if (errspan==null)
alert('enoent '+errspanid);
else
errspan.innerHTML=value.errors.join("<br/>");
});
}
},
error: function (xhr, ajaxOptions, thrownError) {
if (xhr.status!=400)
message(xhr.status+" : "+xhr.responseText);
else message(false);
}});
}
</script>
</th>
</tr>
</thead>
<tbody id="tbmbrsb">
</tbody>
</table>
<input type="button" id="btnnewcircle" value="<%=Html.Translate("Create")%>" class="actionlink rowbtnct" />
</fieldset>
</form>
<script>
$(document).ready(function () {
$("#btnnewuser").click(addUser);
$("#btnnewcircle").click(addCircle);
});
</script>
</asp:Content>

@ -3,6 +3,7 @@
<% using(Html.BeginForm("Register")) %>
<% { %>
<h1>Nouvel utilisateur</h1>
<span class="field-validation-valid error" data-valmsg-replace="false" id="Err_ur_IsApprouved">*</span>
<table class="layout">
<tr><td align="right">

@ -0,0 +1,23 @@
<%@ Page Title="Reset your Password" Language="C#" Inherits="System.Web.Mvc.ViewPage<LostPasswordModel>" MasterPageFile="~/Models/App.master" %>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<%= Html.ValidationSummary("Modification de mot de passe") %>
<% using(Html.BeginForm("ResetPassword", "Account")) { %>
Enter one of the following : <br/>
<ul><li>
<label for="UserName">Your user name (login):</label>
<%= Html.TextBox( "UserName" ) %>
<%= Html.ValidationMessage("UserName", "*") %></li>
<li>
<label for="Email">The e-mail address you used to register here:</label>
<%= Html.TextBox( "Email" ) %>
<%= Html.ValidationMessage("Email", "*") %>
</li>
</ul>
Then, hit the following button:
<input type="submit" value="I lost my password!"/> <br/>
A message will be sent to you, containning a link that you'll can use to reset your password.
<% } %>
</asp:Content>

@ -7,11 +7,11 @@ $(function(){
$("#tbwrts").stupidtable();
});
</script>
<link rel="stylesheet" href="<%=Url.Content("~/Theme/dark/style.css")%>" type="text/css" media="print, projection, screen" />
</asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<%= Html.ValidationSummary("Devis") %>
<% using (Html.BeginForm("Estimate","FrontOffice")) { %>
<%= Html.LabelFor(model => model.Title) %>:<%= Html.TextBox( "Title" ) %>
<%= Html.ValidationMessage("Title", "*") %>
@ -85,10 +85,9 @@ $("#tbwrts").stupidtable();
<asp:Content ContentPlaceHolderID="MASContent" ID="MASContent1" runat="server">
<% ViewData["EstimateId"]=Model.Id; %>
<aside>
<div id="dfnuser" class="hidden">
<%= Html.Partial("Register",new RegisterClientModel(),new ViewDataDictionary(ViewData)
<%= Html.Partial("~/Views/Account/Register.ascx",new RegisterClientModel(),new ViewDataDictionary(ViewData)
{
TemplateInfo = new System.Web.Mvc.TemplateInfo
{
@ -280,6 +279,7 @@ function clearRegistrationValidation(){
$("#Err_ur_Address").text("");
$("#Err_ur_ZipCode").text("");
$("#Err_ur_CityAndState").text("");
$("#Err_ur_IsApprouved").text("");
}
function addRow(){

@ -30,11 +30,16 @@
<add namespace="Yavsc.Model.Google" />
<add namespace="Yavsc.Model.FrontOffice" />
<add namespace="Yavsc.Model.Circles" />
</namespaces>
</pages>
</system.web>
<system.webServer>
<defaultDocument enabled="true"> <!-- this line enables default documents for a directory -->
<files>
<clear/> <!-- removes the existing default document list -->
<add value="Index"/>
</files>
</defaultDocument>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="BlockViewHandler" />

@ -36,7 +36,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
affects performance, set this value to true only
during development.
-->
<compilation defaultLanguage="C#" debug="false">
<compilation defaultLanguage="C#" debug="true" batch="false">
<assemblies>
<add assembly="System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

@ -19,7 +19,6 @@
<DefineConstants>DEBUG;TEST;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<AspNet>
<AspNet DisableCodeBehindGeneration="True" />
</AspNet>
@ -31,6 +30,7 @@
</CustomCommands>
</CustomCommands>
<DocumentationFile>bin\Yavsc.xml</DocumentationFile>
<Externalconsole>true</Externalconsole>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
@ -173,8 +173,6 @@
<Compile Include="Formatters\ErrorHtmlFormatter.cs" />
<Compile Include="Formatters\RssFeedsFormatter.cs" />
<Compile Include="Formatters\TexToPdfFormatter.cs" />
<Compile Include="ApiControllers\BlogsApiController.cs" />
<Compile Include="ApiControllers\FrontOfficeApiController.cs" />
<Compile Include="ApiControllers\PaypalApiController.cs" />
<Compile Include="WebApiConfig.cs" />
<Compile Include="IValueProvider.cs" />
@ -184,10 +182,14 @@
<Compile Include="Formatters\FormatterException.cs" />
<Compile Include="NUnitTestClass.cs" />
<Compile Include="TestExec.cs" />
<Compile Include="ApiControllers\CircleApiController.cs" />
<Compile Include="ApiControllers\BasketApiController.cs" />
<Compile Include="ApiControllers\CalendarApiController.cs" />
<Compile Include="ApiControllers\WorkFlowController.cs" />
<Compile Include="ApiControllers\BasketController.cs" />
<Compile Include="ApiControllers\BlogsController.cs" />
<Compile Include="ApiControllers\CalendarController.cs" />
<Compile Include="ApiControllers\CircleController.cs" />
<Compile Include="ApiControllers\FrontOfficeController.cs" />
<Compile Include="ApiControllers\GCMController.cs" />
<Compile Include="ApiControllers\AccountController.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Web.config" />
@ -252,7 +254,6 @@
<Content Include="Theme\dark\asc.gif" />
<Content Include="Theme\dark\bg.gif" />
<Content Include="Theme\dark\desc.gif" />
<Content Include="Theme\dark\style.css" />
<Content Include="Views\FrontOffice\Estimates.aspx" />
<Content Include="images\pgsql.png" />
<Content Include="Catalog.xml" />
@ -313,7 +314,6 @@
<Content Include="Scripts\jquery-ui.js" />
<Content Include="Views\Account\Profile.aspx" />
<Content Include="robots.txt" />
<Content Include="Views\FrontOffice\Register.ascx" />
<Content Include="Scripts\form-new-user.js" />
<Content Include="Views\FrontOffice\Estimate.aspx" />
<Content Include="Theme\dark\croix.png" />
@ -340,6 +340,8 @@
<Content Include="Theme\md\mdd_modal_background.png" />
<Content Include="Theme\mdd_styles.css" />
<Content Include="Views\Account\Circles.aspx" />
<Content Include="Views\Account\Register.ascx" />
<Content Include="Views\Account\ResetPassword.aspx" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
@ -351,7 +353,7 @@
<Policies>
<DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedFlat" ResourceNamePolicy="FileFormatDefault" />
</Policies>
<XspParameters Port="8080" Address="127.0.0.1" SslMode="None" SslProtocol="Default" KeyType="None" CertFile="" KeyFile="" PasswordOptions="None" Password="" Verbose="True" />
<XspParameters Port="8080" Address="127.0.0.1" SslMode="None" SslProtocol="Ssl2" KeyType="Pkcs12" CertFile="" KeyFile="" PasswordOptions="None" Password="" Verbose="True" />
</Properties>
</MonoDevelop>
</ProjectExtensions>

@ -1,3 +1,34 @@
2015-06-18 Paul Schneider <paul@pschneider.fr>
* YavscModel.csproj:
* LocalizedText.resx:
* LocalizedText.fr.resx:
* LocalizedText.Designer.cs:
* Profile.cs:
* Profile.cs:
* LocalizedText.fr.Designer.cs:
* LoginModel.cs:
* Publishing.cs:
* LoginModel.cs:
* Publishing.cs:
* GCMRegister.cs:
* NewRoleModel.cs:
* GCMRegister.cs:
* NewRoleModel.cs:
* NewAdminModel.cs:
* RegisterModel.cs:
* NewAdminModel.cs:
* RegisterModel.cs:
* RegisterViewModel.cs:
* LostPasswordModel.cs:
* ProviderPublicInfo.cs:
* RegisterViewModel.cs:
* ProviderPublicInfo.cs:
* ChangePasswordModel.cs:
* RegisterClientModel.cs:
* RegisterClientModel.cs:
* ChangePasswordModel.cs:
2015-06-12 Paul Schneider <paul@pschneider.fr>
* YavscModel.csproj:

@ -76,6 +76,12 @@ namespace Yavsc.Model {
}
}
public static string Create {
get {
return ResourceManager.GetString("Create", resourceCulture);
}
}
public static string was_added_to_the_empty_role {
get {
return ResourceManager.GetString("was_added_to_the_empty_role", resourceCulture);
@ -142,6 +148,12 @@ namespace Yavsc.Model {
}
}
public static string Members {
get {
return ResourceManager.GetString("Members", resourceCulture);
}
}
public static string User_name {
get {
return ResourceManager.GetString("User_name", resourceCulture);

@ -76,6 +76,12 @@ namespace Yavsc.Model {
}
}
public static string Create {
get {
return ResourceManager.GetString("Create", resourceCulture);
}
}
public static string was_added_to_the_empty_role {
get {
return ResourceManager.GetString("was_added_to_the_empty_role", resourceCulture);
@ -142,6 +148,12 @@ namespace Yavsc.Model {
}
}
public static string Members {
get {
return ResourceManager.GetString("Members", resourceCulture);
}
}
public static string User_name {
get {
return ResourceManager.GetString("User_name", resourceCulture);

@ -60,4 +60,7 @@
<data name="ImgLocator"><value>URI de l'image</value></data>
<data name="Home"><value>Accueil</value></data>
<data name="Bill edition"><value>Édition d'un billet</value></data>
<data name="Create"><value>Créer</value></data>
<data name="Members"><value>Membres</value></data>
<data name="UserName"><value>Nom d'utilisateur</value></data>
</root>

@ -62,4 +62,7 @@
<data name="ImgLocator"><value>Image URI</value></data>
<data name="Home"><value>Home</value></data>
<data name="Bill edition"><value>Bill edition</value></data>
<data name="Create"><value>Create</value></data>
<data name="Members"><value>Members</value></data>
<data name="UserName"><value>User Name</value></data>
</root>

@ -12,14 +12,14 @@ namespace Yavsc.Model.RolesAndMembers
/// Gets or sets the username.
/// </summary>
/// <value>The username.</value>
[Required(ErrorMessage = "Please enter a Username")]
[Required(ErrorMessage = "Please, enter your user name")]
public string Username { get; set; }
/// <summary>
/// Gets or sets the old password.
/// </summary>
/// <value>The old password.</value>
[Required(ErrorMessage = "Please your old Password")]
[Required(ErrorMessage = "Please, enter your old Password")]
public string OldPassword { get; set; }
/// <summary>

@ -0,0 +1,34 @@
//
// GCMRegister.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
namespace Yavsc.Model.RolesAndMembers
{
public class GCMRegister: RegisterModel
{
public GCMRegister ()
{
}
public string GCMRegistrationId { get; set; }
}
}

@ -0,0 +1,31 @@
//
// LostPasswordModel.cs
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
namespace Yavsc.Model.RolesAndMembers
{
public class LostPasswordModel
{
public string UserName { get; set; }
public string Email { get; set; }
}
}

@ -35,8 +35,8 @@ namespace Yavsc.Model.RolesAndMembers
/// Gets or sets the name of the user.
/// </summary>
/// <value>The name of the user.</value>
[Localizable(true)]
[Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur")]
[Localizable(true), Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur")
,Display(ResourceType=typeof(LocalizedText),Name="UserName")]
public string UserName { get; set; }
/// <summary>

@ -44,14 +44,8 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RolesAndMemebers\ChangePasswordModel.cs" />
<Compile Include="RolesAndMemebers\LoginModel.cs" />
<Compile Include="RolesAndMemebers\NewAdminModel.cs" />
<Compile Include="RolesAndMemebers\NewRoleModel.cs" />
<Compile Include="RolesAndMemebers\RegisterViewModel.cs" />
<Compile Include="Admin\RestoreQuery.cs" />
<Compile Include="Admin\DataAccess.cs" />
<Compile Include="RolesAndMemebers\Profile.cs" />
<Compile Include="FileSystem\FileInfoCollection.cs" />
<Compile Include="WorkFlow\Writting.cs" />
<Compile Include="WorkFlow\Estimate.cs" />
@ -134,8 +128,6 @@
<Compile Include="Google\CalendarEventList.cs" />
<Compile Include="Google\GDate.cs" />
<Compile Include="Google\Resource.cs" />
<Compile Include="RolesAndMemebers\RegisterModel.cs" />
<Compile Include="RolesAndMemebers\RegisterClientModel.cs" />
<Compile Include="Google\Messaging\MessageWithPayLoad.cs" />
<Compile Include="Google\Messaging\MessageWithPayloadResponse.cs" />
<Compile Include="Google\Messaging\Notification.cs" />
@ -149,8 +141,6 @@
<Compile Include="Calendar\Schedule.cs" />
<Compile Include="Calendar\WeekDay.cs" />
<Compile Include="Calendar\YaEvent.cs" />
<Compile Include="RolesAndMemebers\Publishing.cs" />
<Compile Include="RolesAndMemebers\ProviderPublicInfo.cs" />
<Compile Include="Google\GCMRegisterModel.cs" />
<Compile Include="Circles\Circle.cs" />
<Compile Include="Circles\CircleInfo.cs" />
@ -158,10 +148,21 @@
<Compile Include="Circles\CircleManager.cs" />
<Compile Include="Circles\CircleProvider.cs" />
<Compile Include="DataProviderConfigurationSection.cs" />
<Compile Include="RolesAndMembers\ChangePasswordModel.cs" />
<Compile Include="RolesAndMembers\LoginModel.cs" />
<Compile Include="RolesAndMembers\NewAdminModel.cs" />
<Compile Include="RolesAndMembers\NewRoleModel.cs" />
<Compile Include="RolesAndMembers\RegisterViewModel.cs" />
<Compile Include="RolesAndMembers\Profile.cs" />
<Compile Include="RolesAndMembers\RegisterModel.cs" />
<Compile Include="RolesAndMembers\RegisterClientModel.cs" />
<Compile Include="RolesAndMembers\Publishing.cs" />
<Compile Include="RolesAndMembers\ProviderPublicInfo.cs" />
<Compile Include="RolesAndMembers\GCMRegister.cs" />
<Compile Include="RolesAndMembers\LostPasswordModel.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Folder Include="RolesAndMemebers\" />
<Folder Include="WorkFlow\" />
<Folder Include="Blogs\" />
<Folder Include="Admin\" />
@ -172,6 +173,7 @@
<Folder Include="FrontOffice\Catalog\Billing\" />
<Folder Include="Google\Messaging\" />
<Folder Include="Circles\" />
<Folder Include="RolesAndMembers\" />
</ItemGroup>
<ProjectExtensions>
<MonoDevelop>

Loading…