Skip to content

Commit

Permalink
Moved to GitHub
Browse files Browse the repository at this point in the history
  • Loading branch information
horacioj committed Jul 17, 2018
1 parent 2feff3b commit c7663e1
Show file tree
Hide file tree
Showing 2 changed files with 263 additions and 2 deletions.
227 changes: 227 additions & 0 deletions LetMeIn.aspx
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
<%@ Page Language="C#" AutoEventWireup="true" %>

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Reflection" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Collections.Generic" %>

<%@ Import Namespace="DotNetNuke" %>
<%@ Import Namespace="DotNetNuke.Data" %>
<%@ Import Namespace="DotNetNuke.Security" %>
<%@ Import Namespace="DotNetNuke.Entities.Users" %>
<%@ Import Namespace="DotNetNuke.Entities.Profile" %>

<!--
=== DNN Create a Host User tool ===
Created by: Horacio Judeikin (www.evotiva.com)
License: Distributed under the terms of the MIT License
Created : Aug 10, 2010
Updated: Jul 10, 2017
-->

<script language="C#" runat="server">
#region ---------------------- Events ----------------------
///////////////////////////////////////////////////////////////////////
protected void btnGo_Click(object sender, EventArgs e)
{
try
{
ClearResults();
if (txtUsername.Text.Trim() != string.Empty
&& txtPassword.Text.Trim() != string.Empty
&& txtEmail.Text.Trim() != string.Empty)
{
DotNetNuke.Security.Membership.UserCreateStatus userCreateStatus
= CreateUser(Convert.ToInt32(txtPortalId.Text), txtUsername.Text.Trim(), txtPassword.Text.Trim(), txtEmail.Text.Trim());
if (userCreateStatus == DotNetNuke.Security.Membership.UserCreateStatus.Success)
lblResults.Text = "OK - The user has been created.";
else
lblError.Text = string.Format("Error [{0}] - the user was NOT created.", userCreateStatus);
}
else
{
lblError.Text = "Error - all fields must be set. The request was not submitted.";
}
}
catch (Exception ex)
{
lblError.Text = ex.ToString();
}
}
#endregion
#region ---------------------- Private Methods ----------------------
///////////////////////////////////////////////////////////////////////
private void ClearResults()
{
this.lblError.Text = this.lblResults.Text = string.Empty;
}
//////////////////////////////////////////////////////////////////////
private DotNetNuke.Security.Membership.UserCreateStatus CreateUser(int portalid, string username, string password, string email)
{
UserInfo uInfo = new UserInfo();
uInfo.PortalID = Convert.ToInt32(portalid);
uInfo.Username = username;
uInfo.DisplayName = username;
uInfo.FirstName = username;
uInfo.LastName = username;
uInfo.Email = email;
uInfo.IsSuperUser = true;
uInfo.Membership.Password = password;
return UserController.CreateUser(ref uInfo);
}
#endregion
</script>


<!DOCTYPE html>
<html lang="en-US">
<head runat="server">
<!--************************************************-->
<!-- DNN Create Host User tool -->
<!-- Created by: Horacio Judeikin (www.evotiva.com) -->
<!--************************************************-->
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="pragma" content="no-cache" />
<meta name="author" content="Horacio Judeikin - www.evotiva.com" />
<meta name="description" content="DNN Create Host User tool" />
<title>LetMeIn - DNN Create Host User</title>
<style>
body {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
margin-top: 20px;
margin-left: 20px;
}
h1, h2, h3 {
margin-top: 5px;
margin-bottom: 5px;
}
h1 {
font-size: 145%;
}
h2 {
margin-top: 15px;
font-size: 135%;
}
h3 {
font-size: 110%;
color: #2170cd;
}
footer {
font-size: 75%;
}
fieldset {
margin-top: 15px;
border: 0;
}
label {
display: inline-block;
font-weight: 700;
width: 100px;
text-align: right;
}
input[type=text], input[type=password] {
display: inline-block;
padding: 10px;
margin: 5px;
border: 1px solid #e7e6dc;
}
input[type="submit"] {
margin-top: 20px;
padding: 10px;
color: white;
background: #3792ED;
background: -moz-linear-gradient(top, #358eea 0%, #2170cd 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#358eea), color-stop(100%,#2170cd));
background: -webkit-linear-gradient(top, #358eea 0%,#2170cd 100%);
background: linear-gradient(top, #358eea 0%,#2170cd 100%);
-webkit-box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.6), inset 0px 1px 0px 0px rgba(255, 255, 255, 0.4);
box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.6), inset 0px 1px 0px 0px rgba(255, 255, 255, 0.4);
text-shadow: 0px -1px 0px #185B93;
}
.message, .error {
font-weight: 700;
}
.error {
color: red;
}
</style>
</head>

<body>
<form id="frmFindAndReplace" runat="server">
<div>
<h1>LetMeIn</h1>
<footer> <a href="https://www.evotiva.com" target="_blank">by evotiva.com</a> </footer>
<h2>DNN Emergency Create Host User Tool</h2>
<h3>IMPORTANT: Do not leave this page on the site - please remember to delete me!</h3>
<asp:Panel ID="pnlForm" runat="server">

<fieldset>
<div>
<label>Portal Id *:</label>
<asp:TextBox ID="txtPortalId" Columns="5" runat="server" Text="0" />
</div>

<div>
<label>Username *:</label>
<asp:TextBox ID="txtUsername" Columns="30" runat="server" Text="deleteme" />
</div>

<div>
<label>Password *:</label>
<asp:TextBox ID="txtPassword" Columns="30" runat="server" />
</div>

<div>
<label>Email *:</label>
<asp:TextBox ID="txtEmail" Columns="50" runat="server" Text="[email protected]"/>
</div>

<div>
<asp:Button ID="btnGo" CssClass="CommandButton" runat="server" Text="Create Super User"
OnClick="btnGo_Click" OnClientClick="javascript:return confirm('Confirm superuser creation?');"
/>
</div>
</fieldset>

<p class="message">
<asp:Label ID="lblResults" runat="server" Text="" />
</p>
<p class="error">
<asp:Label ID="lblError" runat="server" Text="" />
</p>

</asp:Panel>
</div>
</form>
</body>
</html>
38 changes: 36 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,36 @@
# DNNLetMeIn
DNN Emergency Create Host User Tool
# Evotiva - DNN LetMeIn
## DNN Emergency Create Host User Tool

## Description

OMG! Someone changed the super user password and now nobody knows how to access the site!
(ugh!, there was a single super user account created on the DNN instance)

OMG! I've restored (with DNNBackup, of course) this site, but I don't know any user I can use to login!

OMG! The user is not configured to allow new user registrations, and anyway I don't have direct access to the database to make the 'issuperuser=true' trick!

Don't worry, download this "LetMeIn.aspx" page and upload it to the root of your web site. Then execute it by calling it in the browser (http://www.example.com/LetMeIn.aspx). You'll get a simple form like seen in the screenshot below. Create a new host (super)user and you'll be able to access your site.

Remember to delete "LetMeIn.aspx" as soon as you've finished!

![Evotiva LetMeIn](https://www.evotiva.com/Portals/0/images/LetMeIn_small.jpg "Evotiva Let Me In")

## How to use
- Copy the LetMeIn.aspx file to your web site's root folder.
- Open n a web browser this URL: <yourwebsite>/LetMeIn.aspx
- Use the web form (see the LetMeIn.jpg screenshot) to create a new host user.
- **IMPORTANT:** Delete the LetMeIn.aspx file from your web site's root folder.
- You can now login into your web site using the newly created host user account.
- Once you have normal access to the web site (and created or recovered true host, admin and whatever user accounts), you can delete the newly created host user account.

## Version History

- Created : Aug 10, 2010
- Last Updated: Jul 10, 2017

## Project Sponsor

![Evotiva](https://www.evotiva.com/Portals/0/images/Logo-Evotiva-wbg.png "Evotiva")

This project was donated by [Evotiva](https://www.evotiva.com), makers of [DNN Backup](https://www.evotiva.com/Products/DNNBackup) DNN's premier backup/clone module, [DNN Upgrade](https://www.evotiva.com/Products/DNNUpgrade) accelerator tool, [DNN Global Storage](https://www.evotiva.com/Products/DNNGlobalStorage) (file system providers); which allows you to easily tie-in cloud-based external and local file systems, [DNN GlobalGallery](https://www.evotiva.com/Products/DNNGlobalGallery) The best way to create galleries of media you already have in your web site or favorite cloud storage provider, and [DNN UserFiles](https://www.evotiva.com/Products/DNN-User-Files), a flexible (template-based) Files and Documents manager with many unique and powerful options powered by DNN Global Storage or any other DNN folder provider, including DNN's default built-in providers: standard, secure and database.

0 comments on commit c7663e1

Please sign in to comment.