Skip to the content

How to reset the administrator username and password in Umbraco 8

To reset the username and password for Umrbaco 8 I like to do with within the startup even.

To do this simply create a new class.cs file with the following code.

using System.Web.Mvc;
using System.Web.Optimization;
using Umbraco.Core.Composing;
using Umbraco.Core;
using Umbraco.Core.Services; namespace Website.Core.Events
{
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]
public class StartingComposer : IUserComposer
{
public void Compose(Composition composition)
{
composition.Components().Append<StartingEvent>();
}
}public class StartingEvent : IComponent
{
private readonly IUserService _userService;public StartingEvent(IUserService userService)
{
_userService = userService;
var adminUser = _userService.GetUserById(0);
adminUser.Username = adminUser.Email = "enter the new username here";
adminUser.FailedPasswordAttempts = 0;
adminUser.IsLockedOut = false;
adminUser.IsApproved = true;
adminUser.RawPasswordValue = "enter new password here";
userService.Save(adminUser);
} public void Initialize()
{ } public void Terminate()
{ }
}
}

About the author

David Armitage

.Net MVC Developer
.Net Core Developer
Umbraco Certified Master
Recruitment Professional

Hey Peeps,

I'm an entrepreneur and web developer with a passion for coding. I absolutely love working with Umbraco CMS and appreciate the Umbraco community even more.

I've got 10 years+ .Net experience and 7 years+ experience working in the recruitment industry, both coding and marketing job websites. I wanted to use my skills to help give something back to this awesome community and so I decided to build UmbraJobs.com.

My vision & fundamentals

I want this website to be a place where Umbraco Professionals and Umbraco Partners can advertise their services but at the same time I want to filter out all the under-qualified freelancers & agencies that take up the biggest part of other job & freelancer websites. We've all worked hard to gain our Umbraco certifications, partnership status, and help build the Umbraco community to what it is today. I want to see everyone get rewarded for their efforts.

Follow me on social media

If you're an Umbraco professional, partner, employer, recruiter or a passionate Umbraco community builder then I'm more than happy to hear from you. Follow me on my social media channels and please reach out if you have any needs, want help or consultation with anything Umbraco related or just want a general chat.

comments powered by Disqus

Blog Filter


How we can help?

Need help with an Umbraco project?

Need help with a project but not too sure who to approach? Send us your project brief and budget. We will provide a free consultation and can help you gather quotes from the best and most suitable freelancers or agencies.

Looking to hire an Umbraco Professional?

Have you got job vacancy and want to hire an Umbraco professional? Post a job on our website for free. Alternatively let us know your requirements and we will send suitable prospects your way.

Claim your free profile!

Are you an Umbraco Freelance Developer or Umbraco partner that wants to advertise on our site? If you work with Umbraco or registered as an Umbraco partner then you can create a profile for free.

Let's build the Umbraco Community

We're big on building the Umbraco community and we think you guys are awesome! If there's anyway at all we can help then please reach out.