From 4ff78718734ffaf00d44b4c310524178ec02969a Mon Sep 17 00:00:00 2001 From: Daniel Aguilera Date: Mon, 13 Apr 2020 16:55:18 -0300 Subject: [PATCH] DNN-36360: allow superusers login using email --- .../AuthenticationServices/DNN/Login.ascx.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/DNN Platform/Website/DesktopModules/AuthenticationServices/DNN/Login.ascx.cs b/DNN Platform/Website/DesktopModules/AuthenticationServices/DNN/Login.ascx.cs index ec046303f8d..3daf6f9d258 100644 --- a/DNN Platform/Website/DesktopModules/AuthenticationServices/DNN/Login.ascx.cs +++ b/DNN Platform/Website/DesktopModules/AuthenticationServices/DNN/Login.ascx.cs @@ -5,6 +5,7 @@ #region Usings using System; +using System.Linq; using System.Web; using Microsoft.Extensions.DependencyInjection; using DotNetNuke.Abstractions; @@ -259,7 +260,12 @@ private void OnLoginClick(object sender, EventArgs e) if (emailUsedAsUsername) { // one additonal call to db to see if an account with that email actually exists - userByEmail = UserController.GetUserByEmail(PortalController.GetEffectivePortalId(PortalId), userName); + int totalRecords = 0; + var effectivePortalId = PortalController.GetEffectivePortalId(PortalId); + userByEmail = UserController + .GetUsersByEmail(Null.NullInteger, userName, Null.NullInteger, Null.NullInteger, ref totalRecords) + .Cast() + .FirstOrDefault(user => user.IsSuperUser || user.PortalID == effectivePortalId); if (userByEmail != null) {