nbarbettini / little-aspnetcore-book

The Little ASP.NET Core Book, a friendly introduction to web programming and ASP.NET Core 2.0
http://littleasp.net/book
Creative Commons Attribution 4.0 International
701 stars 190 forks source link

Generate a more secure first-time admin password #58

Open nbarbettini opened 6 years ago

nbarbettini commented 6 years ago

Instead of hard-coding a password like NotSecure123!!, generate a random password for the admin user when seeding the database.

jphellemons commented 6 years ago

I have two options to fix this issue.

  1. 4 based on https://xkcd.com/221/
  2. Powershell ([char[]]([char]33..[char]95) + ([char[]]([char]97..[char]126)) + 0..9 | sort {Get-Random})[0..8] -join ''based on https://blogs.technet.microsoft.com/undocumentedfeatures/2016/09/20/powershell-random-password-generator/