* 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

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

View file

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

View file

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

View file

@ -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(){

View file

@ -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" />