Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow (super)users to log in to portals that have email as username #3659

Merged
merged 2 commits into from
Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ 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(PortalId, userName);
userByEmail = UserController.GetUserByEmail(PortalController.GetEffectivePortalId(PortalId), userName);

if (userByEmail != null)
{
Expand Down
1 change: 1 addition & 0 deletions DNN Platform/Website/DotNetNuke.Website.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3325,6 +3325,7 @@
<Content Include="Providers\DataProviders\SqlDataProvider\09.03.02.SqlDataProvider" />
<Content Include="Providers\DataProviders\SqlDataProvider\09.04.02.SqlDataProvider" />
<Content Include="Providers\DataProviders\SqlDataProvider\09.04.03.SqlDataProvider" />
<Content Include="Providers\DataProviders\SqlDataProvider\09.06.00.SqlDataProvider" />
<None Include="Providers\DataProviders\SqlDataProvider\09.05.00.SqlDataProvider" />
<None Include="Providers\DataProviders\SqlDataProvider\DotNetNuke.Data.SqlDataProvider" />
<None Include="Providers\DataProviders\SqlDataProvider\DotNetNuke.Schema.SqlDataProvider" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/************************************************************/
/***** SqlDataProvider *****/
/***** *****/
/***** *****/
/***** Note: To manually execute this script you must *****/
/***** perform a search and replace operation *****/
/***** for {databaseOwner} and {objectQualifier} *****/
/***** *****/
/************************************************************/

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'{databaseOwner}{objectQualifier}GetSingleUserByEmail') AND type in (N'P', N'PC'))
DROP PROCEDURE {databaseOwner}{objectQualifier}GetSingleUserByEmail
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE {databaseOwner}{objectQualifier}GetSingleUserByEmail
@PortalId INT,
@Email nvarchar(255)
AS
SELECT ISNULL((SELECT TOP 1 U.UserId from {databaseOwner}{objectQualifier}Users U LEFT JOIN {databaseOwner}{objectQualifier}UserPortals UP on UP.[UserId] = U.[UserId] AND UP.[PortalId] = @PortalId WHERE U.Email = @Email AND (UP.[PortalId] = @PortalId OR U.IsSuperUser=1)), -1)
GO

/************************************************************/
/***** SqlDataProvider *****/
/************************************************************/