Fixes the anonymous profile usage
* NpgsqlMembershipProvider.cs: insert a profile record before inserting the users record, to ensure a new foreign key constraint * NpgsqlProfileProvider.cs: better comments * YavscController.cs: Fixes the cookies agreement * HomeController.cs: Finalizes the cookie agreement system. * YavscHelpers.cs: Adds a "click_action_name" field, to give a text to the notification dimissing button. * App.master: Uses the new field from Notification * Web.config: No VB code to compile * Web.csproj: moves Sql files to Sql folder * LocalizedText.resx: * LocalizedText.fr.resx: * LocalizedText.Designer.cs: * LocalizedText.fr.Designer.cs: I understood ... * Notification.cs: a new click action name. * instdbws.sql: permits profile records with no users record associated to, and so, anonymous profiles creation.
This commit is contained in:
parent
e6c65019b0
commit
cbb596ca04
17 changed files with 104 additions and 46 deletions
|
|
@ -37,8 +37,9 @@ namespace Yavsc.ApiControllers
|
|||
public void AllowCookies (Auth model)
|
||||
{
|
||||
if (model.Id != null) {
|
||||
ProfileBase anonymousProfile = ProfileBase.Create (model.Id);
|
||||
anonymousProfile.SetPropertyValue ("allowcookies", true);
|
||||
ProfileBase pr = ProfileBase.Create (model.Id);
|
||||
pr.SetPropertyValue ("allowcookies", true);
|
||||
pr.Save ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@ CREATE TABLE users
|
|||
failedpasswordanswerattemptcount integer,
|
||||
failedpasswordanswerattemptwindowstart timestamp with time zone,
|
||||
CONSTRAINT users_pkey PRIMARY KEY (pkid),
|
||||
CONSTRAINT users_applicationname_fkey FOREIGN KEY (applicationname, username)
|
||||
REFERENCES profiles (applicationname, username) MATCH SIMPLE
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
CONSTRAINT uniquelogin UNIQUE (applicationname, email),
|
||||
CONSTRAINT uniquemail UNIQUE (applicationname, username)
|
||||
)
|
||||
|
|
@ -82,9 +85,6 @@ CREATE TABLE profiles
|
|||
lastactivitydate timestamp with time zone,
|
||||
lastupdateddate timestamp with time zone,
|
||||
CONSTRAINT profiles_pkey PRIMARY KEY (uniqueid),
|
||||
CONSTRAINT fk_profileusers FOREIGN KEY (username, applicationname)
|
||||
REFERENCES users (username, applicationname) MATCH SIMPLE
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
CONSTRAINT pkprofiles UNIQUE (username, applicationname)
|
||||
)
|
||||
WITH (
|
||||
|
|
@ -1,3 +1,23 @@
|
|||
2015-11-03 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* YavscController.cs: Fixes the cookies agreement
|
||||
|
||||
* HomeController.cs: Finalizes the cookie agreement system.
|
||||
|
||||
* YavscHelpers.cs: Adds a "click_action_name" field, to give a
|
||||
text to the notification dimissing button.
|
||||
|
||||
|
||||
* App.master: Uses the new field from Notification
|
||||
|
||||
* Web.config: No VB code to compile
|
||||
|
||||
* Web.csproj: moves Sql files to Sql folder
|
||||
|
||||
* instdbws.sql: permits profile records with no users record
|
||||
associated to,
|
||||
and so, anonymous profiles creation.
|
||||
|
||||
2015-11-01 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* CalAuth.aspx: A view ... still unused
|
||||
|
|
|
|||
|
|
@ -24,21 +24,6 @@ namespace Yavsc.Controllers
|
|||
/// </summary>
|
||||
public class HomeController : Controller
|
||||
{
|
||||
// Site name
|
||||
private static string name = null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the site name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
[Obsolete("Use YavscHelpers.SiteName insteed.")]
|
||||
public static string Name {
|
||||
get {
|
||||
if (name == null)
|
||||
name = WebConfigurationManager.AppSettings ["Name"];
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lists the referenced assemblies.
|
||||
|
|
@ -87,16 +72,15 @@ namespace Yavsc.Controllers
|
|||
/// </summary>
|
||||
public ActionResult Index ()
|
||||
{
|
||||
var anonid = Request.AnonymousID;
|
||||
if (Session.IsNewSession) {
|
||||
if (!Request.IsAuthenticated) {
|
||||
ProfileBase anonymousProfile = ProfileBase.Create(anonid);
|
||||
object ac = anonymousProfile.GetPropertyValue ("allowcookies");
|
||||
|
||||
if (ac is string && ((string)ac)!="true")
|
||||
YavscHelpers.Notify (ViewData, LocalizedText.ThisSiteUsesCookies,
|
||||
"function(){Yavsc.ajax(\"/Yavsc/AllowCookies\", { id:'"+anonid+"' });}");
|
||||
}
|
||||
string uid = (!Request.IsAuthenticated) ? Request.AnonymousID : User.Identity.Name;
|
||||
ProfileBase pr =
|
||||
ProfileBase.Create (uid);
|
||||
bool ac = (bool) pr.GetPropertyValue ("allowcookies");
|
||||
if (!ac)
|
||||
YavscHelpers.Notify (ViewData, LocalizedText.ThisSiteUsesCookies,
|
||||
"function(){Yavsc.ajax(\"/Yavsc/AllowCookies\", { id:'"+uid+"' });}",
|
||||
LocalizedText.I_understood);
|
||||
}
|
||||
|
||||
foreach (string tagname in new string[] {"Accueil","Événements","Mentions légales"})
|
||||
|
|
|
|||
|
|
@ -225,12 +225,17 @@ namespace Yavsc.Helpers
|
|||
JavaScriptSerializer serializer = new JavaScriptSerializer();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
public static void Notify(ViewDataDictionary ViewData, string message, string click_action=null) {
|
||||
|
||||
public static void Notify(ViewDataDictionary ViewData, string message, string click_action=null, string clickActionName="Ok") {
|
||||
Notify(ViewData, new Notification { body = YavscAjaxHelper.QuoteJavascriptString(message),
|
||||
click_action = click_action, click_action_name = YavscAjaxHelper.QuoteJavascriptString(clickActionName)} ) ;
|
||||
}
|
||||
|
||||
public static void Notify(ViewDataDictionary ViewData, Notification note) {
|
||||
if (ViewData ["Notifications"] == null)
|
||||
ViewData ["Notifications"] = new List<Notification> ();
|
||||
(ViewData ["Notifications"] as List<Notification>).Add (
|
||||
new Notification { body = YavscAjaxHelper.QuoteJavascriptString(message),
|
||||
click_action = click_action } ) ;
|
||||
note ) ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Files the list.
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>';
|
|||
$(document).ready(function(){
|
||||
<% foreach (Notification note in (IEnumerable<Notification>) ViewData ["Notifications"] ) {
|
||||
if (note.click_action == null) {%> Yavsc.notice(<%=note.body%>); <% }
|
||||
else {%> Yavsc.notice(<%=note.body%>, <%=note.click_action%>); <% } %>
|
||||
else {%> Yavsc.notice(<%=note.body%>, <%=note.click_action%>, <%=note.click_action_name%>); <% } %>
|
||||
<% } %>
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -179,11 +179,12 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
|
|||
<providerOption name="CompilerVersion" value="v4.0" />
|
||||
<providerOption name="WarnAsError" value="false" />
|
||||
</compiler>
|
||||
<!--
|
||||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<providerOption name="CompilerVersion" value="v4.0" />
|
||||
<providerOption name="OptionInfer" value="true" />
|
||||
<providerOption name="WarnAsError" value="false" />
|
||||
</compiler>
|
||||
</compiler> -->
|
||||
</compilers>
|
||||
</system.codedom>
|
||||
<!-- <system.web.extensions>
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@
|
|||
<Folder Include="App_Data\" />
|
||||
<Folder Include="App_Themes\images\" />
|
||||
<Folder Include="Views\Google\" />
|
||||
<Folder Include="App_Data\Sql\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Controllers\HomeController.cs" />
|
||||
|
|
@ -533,7 +534,7 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="App_Data\instdbws.sql" />
|
||||
<EmbeddedResource Include="App_Data\Sql\instdbws.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WebReferences Include="Web References" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue