diff --git a/Gemfile b/Gemfile index 09b10c97f..b681721c0 100644 --- a/Gemfile +++ b/Gemfile @@ -26,6 +26,7 @@ gem 'marcel' gem 'sidekiq-unique-jobs' gem 'redis' gem 'request_store' +gem "zxcvbn-ruby", require: "zxcvbn" gem "diffy" gem "rugged" diff --git a/Gemfile.lock b/Gemfile.lock index d924493e8..17e4506a4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -376,6 +376,7 @@ GEM websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) zeitwerk (2.6.13) + zxcvbn-ruby (1.2.0) PLATFORMS ruby @@ -426,6 +427,7 @@ DEPENDENCIES streamio-ffmpeg webmock webpacker (>= 4.0.x) + zxcvbn-ruby BUNDLED WITH 2.4.10 diff --git a/README.md b/README.md index 04d410097..8af7f592d 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ docker compose up ``` After running the commands once only `docker compose up` is needed to bring up the containers. -1. To confirm the installation worked, open the web browser of your choice and enter `http://localhost:3000` into the address bar and see if the website loads correctly. An admin account has been created automatically, the username and password are `admin` and `qwerty` respectively. +1. To confirm the installation worked, open the web browser of your choice and enter `http://localhost:3000` into the address bar and see if the website loads correctly. An admin account has been created automatically, the username and password are `admin` and `hexerade` respectively. 1. By default, the site will lack any content. For testing purposes, you can generate some using the following command: ``` docker exec -it e621ng-e621-1 /app/bin/populate diff --git a/app/javascript/src/javascripts/password.js b/app/javascript/src/javascripts/password.js new file mode 100644 index 000000000..158ee56a8 --- /dev/null +++ b/app/javascript/src/javascripts/password.js @@ -0,0 +1,70 @@ +import zxcvbn from "zxcvbn"; +import Page from "./utility/page"; + +let Password = {}; + +Password.init_validation = function () { + if (Page.matches("users", "new") || Page.matches("users", "create")) + Password.bootstrap_input($("#user_password"), [$("#user_name"), $("#user_email")]); + + if (Page.matches("maintenance-user-password-resets", "edit")) + Password.bootstrap_input($("#password")); + + if (Page.matches("maintenance-user-passwords", "edit")) + Password.bootstrap_input($("#user_password")); +}; + +Password.bootstrap_input = function ($password, $inputs = []) { + // Set up the UI + $password.parent().addClass("password-input"); + + const hint = $("
If you supplied an email address when signing up, <%= Danbooru.config.app_name %> can email you your login information. Password details will not be provided and will not be changed.
-If you didn't supply a valid email address, you are out of luck.
- - <%= form_tag(maintenance_user_login_reminder_path, :class => "simple_form") do %> -Invalid reset
+ <% if @nonce %> + <%= form_tag(maintenance_user_password_reset_path, :method => :put, :class => "simple_form session_form") do %> +Invalid reset
+ <% end %> +If you supplied an email address when signing up, <%= Danbooru.config.app_name %> can reset your password. You will receive an email confirming your request for a new password.
-If you didn't supply a valid email address, there is no way to recover your account.
- - <%= form_tag(maintenance_user_password_reset_path, :class => "simple_form") do %> -An account is free and lets you keep favorites, upload artwork, and write comments.
+ <%= f.input :name, label: "Username", as: :string %> + <%= f.input :email, :required => true, as: :email %> + <%= f.input :password %> + <%= f.input :password_confirmation %> -Make sure to read the site rules before continuing.
-You must confirm your email address, so use something you can receive email with.
-This site is open to web crawlers so whatever name you choose will be public!
-This includes favorites, uploads, and comments. Almost everything is public. So don't choose a name you don't want to be associated with.
-Accounts are prefilled with the same blacklist as guests have. You can access your blacklist in your account settings.
-Please, read the site rules before making an account.
+You must confirm your email address, so you should only use one that you have access to.
+This site is open to web crawlers, meaning that almost everything is public.
+This includes your account name, favorites, uploads, and comments. Do not choose a name you don't want to be associated with.
+Accounts have the same blacklist as guests by default. You will be able to modify your blacklist in the account settings.