Skip to content

Commit

Permalink
Force user logout after password changed in other place. (#2509)
Browse files Browse the repository at this point in the history
* DNN-27517: force user logout after password changed in other place.

* DNN-27517: update code by review.

* DNN-27517: add host settings to control whether force logout after password changed.

* NOJIRA: mark as stable.

* Fixed bugs on add/remove user permissions for modules

* Change algorithm to SHA1CryptoServiceProvider

* Updated Issue Templates to include new RFC template and to support submissions for 9.3.0 release

* Corrected structure to avoid issue linking

* code review

* User registration: end the response after redirect (#2511)

* Initial New User Email Not Sending At Time of Creation (#2492)

This is alternative way to fix above issue proposed in dnnsoftware/Dnn.AdminExperience#174

As per @sleupold , we need to move email notifications from UI to core part.
Once this will be approved and merged, we can remove email notifications from UI and replace it with updated controller method to let notifications to be send to their recipients.

fixes #2424

* Fix for missing SQL change (#2522)

Fixes #2521 by rebuilding the PortalsDefaultLanguage view

* Resolve UserProfile Loading Errors From Unsecure pages (#2494)

* NOJIRA: mark as stable.

* DNN-21637: add config key.

* DNN-26576: prevent same-origin errors when loading popup and iframes from a secure page.

* code review

* Code review

* (DNN-10795) - All pages except home page return 404 (#2032)

* DNN-10795 - All pages except home page return 404

I have witnessed that occasionally on app pool recycle all,except the home page, will return 404 until the application pool is recycled a second time.

I've reviewed the code & believe that the root cause of the issue is due to the fact that the code that builds the tab index, portalDepths dictionary & tabPaths dictionary is not thread safe. I can see code in the method TabIndexController.FetchTabDictionary is using SharedDictionary classes to store the tab dictionaries, however the code is not thread safe when adding the dictionaries to the cache. Therefore when multiple threads are executing the FetchTabDictionary method it's possible for an empty dictionary to be added to the cache.

To resolve this issue the code has been updated so that only one thread can add the dictionaries to cache at a time.

* Updated comment to trigger Code Licence workflow.

* Added compiled DLLs that include the fix for bug DNN-10795 (All pages except home page return 404) for DNn versions 8.0.4 through 9.2.2

* Recursive read lock acquisitions not allowed (#2423)

* DNN-23293 Recursive read lock acquisitions not allowed in this mode.

* DNN-23293 Recursive read lock acquisitions not allowed in this mode.

* Performance problems when huge number of portal aliases is in use (#2514)

* DNN-27498 Performance Issues

* DNN-27498 Performance Issues

* minor formatting

* Fixed case sensitivity issue

* Added mixed cased alias support to unit tests

* Fixed VanityUrl unit tests

* Fixed broken LockStrategy unit tests (#2531)

* Delete Fixed-DLLs folder that was added as part of PR for bug DNN-10795. (#2535)

* Modules > ModuleCreator > fixed path error (#2527)

* Fixed issue in ModuleCreator > Web > template.ascx

* Update DNN Platform/Admin Modules/Dnn.Modules.ModuleCreator/Templates/Web/Module - HTML/template.ascx

Co-Authored-By: mean2me <emanuele.colonnelli@gmail.com>

* All languages are highlighted along with current
- add css for languages

* Log name of package when uninstalling extensions (#2557)

* remove spaces

* DNN-20856 After export with Content Localization site language flags disappears from pages (#2578)

* Fixed parallel build (#2562)

* Set active Nuget package source to All

* Fixed parallel build

* Inclusion of NDepend logo on the readme. (#2598)

* Fix for missing SQL change

Fixes #2521 by rebuilding the PortalsDefaultLanguage view

* Added attribution to NDepend for the usage of their ADO tooling

* Fix image/link markdown

* Get language from transferred parameter (#2607)

* switch encrypt method. (#2616)

* DNN-29484: switch encrypt method.

* NuGet Package Improvements

Changes to modernize the NuGet packages published by the DNN Platform, fixes #2586.  The below-submitted changes in structure have been validated by consultation with the DNN Platform Community, Microsoft Representatives, as well as validation of documentation per the published .nuspec file definition (https://docs.microsoft.com/en-us/nuget/reference/nuspec)

In detail, the following items have been changed:

* Migration of license information to the suggested <license> node rather than the deprecated <licenseurl> node.
* Inclusion of target framework for all included .dll files, this prevents installation of the package to pre-4.5 projects protecting downstream users.
* Improved package descriptions based on discussions held in the RFC regarding these improvements
* Added Package-to-Package dependencies to ensure quick usage and inclusion
* Updated the WebAPI and MVC packages to be holistic packages, including references to ALL needed items to develop using those patterns.

All changes are current for DNN Platform version 9.3.0 or later.  Packages have been built & tested locally with success.

## Suggested Usage

With these improved packages, development & references should be easier.

### MVC Modules

`Install-Package DotNetNuke.Web.Mvc`

Should be the only needed package installation.  It will install all needed dependencies, including the items necessary for WebAPI

### Modules Needing WebAPI (Not MVC)

`Install-Package DotNetNuke.WebApi`

Should be the only needed package for extensions not using MVC, however, needing to use WebApi for services.  This will work well for WebForms or Library projects, etc. that don't need the extra references for MVC/Razor

### WebForms/Limited Modules

`Install-Package DotNetNuke.Core`

The most simple modules, still using the WebForms pattern can use this package for the smallest footprint

For #2600

* Adjust the Source package to include changes from GitVersion (#2609)

* remove old ckeditor packaging steps

* Remove version to allow GitVersion to set it at build time (#2639)

* Adding 09.03.01.SqlDataProvider file

* Upgrade DNN to .NET Framework 4.7.2 (#2644)

* Upgraded app projects to .NET Framework 4.7.2; Added missing dependency to DotNetNuke.Tests.Core as it was missing DotNetNuke.Web.Client

* Removed targetframework web.config reference from Dnn.Modules.Console

* Reverted unintended changes
  • Loading branch information
Ben authored and mitchelsellers committed May 14, 2019
1 parent cb5c2d0 commit 1cedd7d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
36 changes: 33 additions & 3 deletions DNN Platform/HttpModules/Membership/MembershipModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@
using DotNetNuke.Application;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Controllers;
using DotNetNuke.Entities.Host;
using DotNetNuke.Entities.Portals;
using DotNetNuke.Entities.Users;
using DotNetNuke.HttpModules.Services;
using DotNetNuke.Instrumentation;
using DotNetNuke.Security;
using DotNetNuke.Security.Roles;
using DotNetNuke.Services.Localization;
Expand All @@ -52,6 +54,8 @@ namespace DotNetNuke.HttpModules.Membership
/// </summary>
public class MembershipModule : IHttpModule
{
private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(MembershipModule));

private static readonly Regex NameRegex = new Regex(@"\w+[\\]+(?=)", RegexOptions.Compiled);

private static string _cultureCode;
Expand Down Expand Up @@ -184,9 +188,7 @@ public static void AuthenticateRequest(HttpContextBase context, bool allowUnknow
}

//authenticate user and set last login ( this is necessary for users who have a permanent Auth cookie set )
if (user == null || user.IsDeleted || user.Membership.LockedOut
|| (!user.Membership.Approved && !user.IsInRole("Unverified Users"))
|| !user.Username.Equals(context.User.Identity.Name, StringComparison.InvariantCultureIgnoreCase))
if (RequireLogout(context, user))
{
var portalSecurity = PortalSecurity.Instance;
portalSecurity.SignOut();
Expand Down Expand Up @@ -256,5 +258,33 @@ public static void AuthenticateRequest(HttpContextBase context, bool allowUnknow
context.Items.Add("UserInfo", new UserInfo());
}
}

private static bool RequireLogout(HttpContextBase context, UserInfo user)
{
try
{
if (user == null || user.IsDeleted || user.Membership.LockedOut
|| !user.Membership.Approved && !user.IsInRole("Unverified Users")
|| !user.Username.Equals(context.User.Identity.Name, StringComparison.InvariantCultureIgnoreCase))
{
return true;
}

var forceLogout = HostController.Instance.GetBoolean("ForceLogoutAfterPasswordChanged");
if (!forceLogout)
{
return false;
}

// if user's password changed after the user cookie created, then force user to login again.
var issueDate = ((FormsIdentity)context.User.Identity)?.Ticket.IssueDate;
return !Null.IsNull(issueDate) && issueDate < user.Membership.LastPasswordChangeDate;
}
catch (Exception ex)
{
Logger.Error(ex);
return true;
}
}
}
}
1 change: 1 addition & 0 deletions Website/DesktopModules/Admin/Security/EditUser.ascx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ private void PasswordUpdated(object sender, Password.PasswordUpdatedEventArgs e)
{
//The User changed his own password
Mail.SendMail(User, MessageType.UserUpdatedOwnPassword, PortalSettings);
PortalSecurity.Instance.SignIn(User, false);
}
AddModuleMessage("PasswordChanged", ModuleMessage.ModuleMessageType.GreenSuccess, true);
}
Expand Down
1 change: 1 addition & 0 deletions Website/Install/DotNetNuke.install.config.resources
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<EncryptionKey Secure="True"></EncryptionKey>
<EventLogBuffer>N</EventLogBuffer>
<FileExtensions>jpg,jpeg,jpe,gif,bmp,png,svg,ttf,eot,woff,doc,docx,xls,xlsx,ppt,pptx,pdf,txt,xml,xsl,xsd,css,zip,rar,template,htmtemplate,ico,avi,mpg,mpeg,mp3,wmv,mov,wav,mp4,webm,ogv</FileExtensions>
<ForceLogoutAfterPasswordChanged>Y</ForceLogoutAfterPasswordChanged>
<HelpURL>http://www.dnnsoftware.com/help</HelpURL>
<HostCurrency>USD</HostCurrency>
<HostEmail></HostEmail>
Expand Down

0 comments on commit 1cedd7d

Please sign in to comment.