Compare commits
26 Commits
a2d19b4195
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| d5a396f53a | |||
| 5a38d132b8 | |||
| 6ebb7390d5 | |||
| 92ceddc32e | |||
| 791034f7a4 | |||
| 9267adbecb | |||
| b6e558e6dd | |||
| d1222a6baa | |||
| 02185cac54 | |||
| 03b5ab680b | |||
| bfd075048d | |||
| 7d2be7f137 | |||
| d963716372 | |||
| 5991fd1296 | |||
| 5d472a6271 | |||
| e1bd95987b | |||
| f6baae259e | |||
| ba3392fb47 | |||
| 0edc7d0563 | |||
| b72f88f60f | |||
| 95675aa5ef | |||
| 32a06d8c61 | |||
| dcd4efdd4e | |||
| 781b2bb9f0 | |||
| d3fb547fb1 | |||
| 61019d0331 |
8
.rubocop.yml
Normal file
8
.rubocop.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# Omakase Ruby styling for Rails
|
||||||
|
inherit_gem: { rubocop-rails-omakase: rubocop.yml }
|
||||||
|
|
||||||
|
# Overwrite or add rules to create your own house style
|
||||||
|
#
|
||||||
|
# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
|
||||||
|
# Layout/SpaceInsideArrayLiteralBrackets:
|
||||||
|
# Enabled: false
|
||||||
65
Gemfile
65
Gemfile
@@ -1,12 +1,20 @@
|
|||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
||||||
|
|
||||||
ruby "3.3.1"
|
ruby "4.0.2"
|
||||||
|
|
||||||
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
|
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
|
||||||
gem "rails", "7.1.3.2"
|
gem "rails", "8.1.3"
|
||||||
|
gem "propshaft"
|
||||||
|
gem "puma", "~> 6.0"
|
||||||
|
gem "importmap-rails"
|
||||||
|
gem "turbo-rails"
|
||||||
|
gem "stimulus-rails"
|
||||||
|
gem "jbuilder"
|
||||||
|
|
||||||
gem 'devise'
|
gem 'devise'
|
||||||
|
gem 'devise-two-factor'
|
||||||
|
gem 'rqrcode'
|
||||||
|
|
||||||
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
|
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
|
||||||
gem "sprockets-rails"
|
gem "sprockets-rails"
|
||||||
@@ -14,35 +22,18 @@ gem "sprockets-rails"
|
|||||||
# Use mysql as the database for Active Record
|
# Use mysql as the database for Active Record
|
||||||
gem "mysql2", "~> 0.5"
|
gem "mysql2", "~> 0.5"
|
||||||
|
|
||||||
# Use the Puma web server [https://github.com/puma/puma]
|
|
||||||
gem "puma", "~> 6.0"
|
|
||||||
|
|
||||||
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
|
gem "tzinfo-data", platforms: %i[ windows jruby ]
|
||||||
gem "importmap-rails"
|
|
||||||
|
|
||||||
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
|
# Use the database-backed adapters for Rails.cache, Active Job, and Action Cable
|
||||||
gem "turbo-rails"
|
gem "solid_cache"
|
||||||
|
gem "solid_queue"
|
||||||
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
|
gem "solid_cable"
|
||||||
gem "stimulus-rails"
|
|
||||||
|
|
||||||
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
|
|
||||||
gem "jbuilder"
|
|
||||||
|
|
||||||
# Use Redis adapter to run Action Cable in production
|
|
||||||
# gem "redis", "~> 4.0"
|
|
||||||
|
|
||||||
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
|
|
||||||
# gem "kredis"
|
|
||||||
|
|
||||||
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
|
|
||||||
# gem "bcrypt", "~> 3.1.7"
|
|
||||||
|
|
||||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
|
||||||
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
|
|
||||||
|
|
||||||
# Reduces boot times through caching; required in config/boot.rb
|
# Reduces boot times through caching; required in config/boot.rb
|
||||||
gem "bootsnap", require: false
|
gem "bootsnap", require: false
|
||||||
|
gem "thruster", require: false
|
||||||
|
gem "image_processing", "~> 1.2"
|
||||||
|
|
||||||
# Use Sass to process CSS
|
# Use Sass to process CSS
|
||||||
# gem "sassc-rails"
|
# gem "sassc-rails"
|
||||||
@@ -52,23 +43,25 @@ gem "bootsnap", require: false
|
|||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
||||||
gem "debug", platforms: %i[ mri mingw x64_mingw ]
|
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
|
||||||
|
|
||||||
|
# Audits gems for known security defects (use config/bundler-audit.yml to ignore issues)
|
||||||
|
gem "bundler-audit", require: false
|
||||||
|
|
||||||
|
# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
|
||||||
|
gem "brakeman", require: false
|
||||||
|
|
||||||
|
# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
|
||||||
|
gem "rubocop-rails-omakase", require: false
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
# Use console on exceptions pages [https://github.com/rails/web-console]
|
# Use console on exceptions pages [https://github.com/rails/web-console]
|
||||||
gem "web-console"
|
gem "web-console"
|
||||||
|
|
||||||
# Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
|
|
||||||
# gem "rack-mini-profiler"
|
|
||||||
|
|
||||||
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
|
|
||||||
# gem "spring"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
|
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
|
||||||
gem "capybara"
|
gem "capybara", "~> 3.40"
|
||||||
gem "selenium-webdriver"
|
gem "selenium-webdriver", "~> 4.43"
|
||||||
gem "webdrivers"
|
|
||||||
end
|
end
|
||||||
|
|||||||
428
Gemfile.lock
428
Gemfile.lock
@@ -1,89 +1,95 @@
|
|||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actioncable (7.1.3.2)
|
action_text-trix (2.1.18)
|
||||||
actionpack (= 7.1.3.2)
|
railties
|
||||||
activesupport (= 7.1.3.2)
|
actioncable (8.1.3)
|
||||||
|
actionpack (= 8.1.3)
|
||||||
|
activesupport (= 8.1.3)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
websocket-driver (>= 0.6.1)
|
websocket-driver (>= 0.6.1)
|
||||||
zeitwerk (~> 2.6)
|
zeitwerk (~> 2.6)
|
||||||
actionmailbox (7.1.3.2)
|
actionmailbox (8.1.3)
|
||||||
actionpack (= 7.1.3.2)
|
actionpack (= 8.1.3)
|
||||||
activejob (= 7.1.3.2)
|
activejob (= 8.1.3)
|
||||||
activerecord (= 7.1.3.2)
|
activerecord (= 8.1.3)
|
||||||
activestorage (= 7.1.3.2)
|
activestorage (= 8.1.3)
|
||||||
activesupport (= 7.1.3.2)
|
activesupport (= 8.1.3)
|
||||||
mail (>= 2.7.1)
|
mail (>= 2.8.0)
|
||||||
net-imap
|
actionmailer (8.1.3)
|
||||||
net-pop
|
actionpack (= 8.1.3)
|
||||||
net-smtp
|
actionview (= 8.1.3)
|
||||||
actionmailer (7.1.3.2)
|
activejob (= 8.1.3)
|
||||||
actionpack (= 7.1.3.2)
|
activesupport (= 8.1.3)
|
||||||
actionview (= 7.1.3.2)
|
mail (>= 2.8.0)
|
||||||
activejob (= 7.1.3.2)
|
|
||||||
activesupport (= 7.1.3.2)
|
|
||||||
mail (~> 2.5, >= 2.5.4)
|
|
||||||
net-imap
|
|
||||||
net-pop
|
|
||||||
net-smtp
|
|
||||||
rails-dom-testing (~> 2.2)
|
rails-dom-testing (~> 2.2)
|
||||||
actionpack (7.1.3.2)
|
actionpack (8.1.3)
|
||||||
actionview (= 7.1.3.2)
|
actionview (= 8.1.3)
|
||||||
activesupport (= 7.1.3.2)
|
activesupport (= 8.1.3)
|
||||||
nokogiri (>= 1.8.5)
|
nokogiri (>= 1.8.5)
|
||||||
racc
|
|
||||||
rack (>= 2.2.4)
|
rack (>= 2.2.4)
|
||||||
rack-session (>= 1.0.1)
|
rack-session (>= 1.0.1)
|
||||||
rack-test (>= 0.6.3)
|
rack-test (>= 0.6.3)
|
||||||
rails-dom-testing (~> 2.2)
|
rails-dom-testing (~> 2.2)
|
||||||
rails-html-sanitizer (~> 1.6)
|
rails-html-sanitizer (~> 1.6)
|
||||||
actiontext (7.1.3.2)
|
useragent (~> 0.16)
|
||||||
actionpack (= 7.1.3.2)
|
actiontext (8.1.3)
|
||||||
activerecord (= 7.1.3.2)
|
action_text-trix (~> 2.1.15)
|
||||||
activestorage (= 7.1.3.2)
|
actionpack (= 8.1.3)
|
||||||
activesupport (= 7.1.3.2)
|
activerecord (= 8.1.3)
|
||||||
|
activestorage (= 8.1.3)
|
||||||
|
activesupport (= 8.1.3)
|
||||||
globalid (>= 0.6.0)
|
globalid (>= 0.6.0)
|
||||||
nokogiri (>= 1.8.5)
|
nokogiri (>= 1.8.5)
|
||||||
actionview (7.1.3.2)
|
actionview (8.1.3)
|
||||||
activesupport (= 7.1.3.2)
|
activesupport (= 8.1.3)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubi (~> 1.11)
|
erubi (~> 1.11)
|
||||||
rails-dom-testing (~> 2.2)
|
rails-dom-testing (~> 2.2)
|
||||||
rails-html-sanitizer (~> 1.6)
|
rails-html-sanitizer (~> 1.6)
|
||||||
activejob (7.1.3.2)
|
activejob (8.1.3)
|
||||||
activesupport (= 7.1.3.2)
|
activesupport (= 8.1.3)
|
||||||
globalid (>= 0.3.6)
|
globalid (>= 0.3.6)
|
||||||
activemodel (7.1.3.2)
|
activemodel (8.1.3)
|
||||||
activesupport (= 7.1.3.2)
|
activesupport (= 8.1.3)
|
||||||
activerecord (7.1.3.2)
|
activerecord (8.1.3)
|
||||||
activemodel (= 7.1.3.2)
|
activemodel (= 8.1.3)
|
||||||
activesupport (= 7.1.3.2)
|
activesupport (= 8.1.3)
|
||||||
timeout (>= 0.4.0)
|
timeout (>= 0.4.0)
|
||||||
activestorage (7.1.3.2)
|
activestorage (8.1.3)
|
||||||
actionpack (= 7.1.3.2)
|
actionpack (= 8.1.3)
|
||||||
activejob (= 7.1.3.2)
|
activejob (= 8.1.3)
|
||||||
activerecord (= 7.1.3.2)
|
activerecord (= 8.1.3)
|
||||||
activesupport (= 7.1.3.2)
|
activesupport (= 8.1.3)
|
||||||
marcel (~> 1.0)
|
marcel (~> 1.0)
|
||||||
activesupport (7.1.3.2)
|
activesupport (8.1.3)
|
||||||
base64
|
base64
|
||||||
bigdecimal
|
bigdecimal
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.3.1)
|
||||||
connection_pool (>= 2.2.5)
|
connection_pool (>= 2.2.5)
|
||||||
drb
|
drb
|
||||||
i18n (>= 1.6, < 2)
|
i18n (>= 1.6, < 2)
|
||||||
|
json
|
||||||
|
logger (>= 1.4.2)
|
||||||
minitest (>= 5.1)
|
minitest (>= 5.1)
|
||||||
mutex_m
|
securerandom (>= 0.3)
|
||||||
tzinfo (~> 2.0)
|
tzinfo (~> 2.0, >= 2.0.5)
|
||||||
addressable (2.8.6)
|
uri (>= 0.13.1)
|
||||||
public_suffix (>= 2.0.2, < 6.0)
|
addressable (2.9.0)
|
||||||
base64 (0.2.0)
|
public_suffix (>= 2.0.2, < 8.0)
|
||||||
bcrypt (3.1.20)
|
ast (2.4.3)
|
||||||
bigdecimal (3.1.8)
|
base64 (0.3.0)
|
||||||
|
bcrypt (3.1.22)
|
||||||
|
bigdecimal (4.1.2)
|
||||||
bindex (0.8.1)
|
bindex (0.8.1)
|
||||||
bootsnap (1.18.3)
|
bootsnap (1.23.0)
|
||||||
msgpack (~> 1.2)
|
msgpack (~> 1.2)
|
||||||
builder (3.2.4)
|
brakeman (8.0.4)
|
||||||
|
racc
|
||||||
|
builder (3.3.0)
|
||||||
|
bundler-audit (0.9.3)
|
||||||
|
bundler (>= 1.2.0)
|
||||||
|
thor (~> 1.0)
|
||||||
capybara (3.40.0)
|
capybara (3.40.0)
|
||||||
addressable
|
addressable
|
||||||
matrix
|
matrix
|
||||||
@@ -93,186 +99,298 @@ GEM
|
|||||||
rack-test (>= 0.6.3)
|
rack-test (>= 0.6.3)
|
||||||
regexp_parser (>= 1.5, < 3.0)
|
regexp_parser (>= 1.5, < 3.0)
|
||||||
xpath (~> 3.2)
|
xpath (~> 3.2)
|
||||||
concurrent-ruby (1.2.3)
|
chunky_png (1.4.0)
|
||||||
connection_pool (2.4.1)
|
concurrent-ruby (1.3.6)
|
||||||
|
connection_pool (3.0.2)
|
||||||
crass (1.0.6)
|
crass (1.0.6)
|
||||||
date (3.3.4)
|
date (3.5.1)
|
||||||
debug (1.9.2)
|
debug (1.11.1)
|
||||||
irb (~> 1.10)
|
irb (~> 1.10)
|
||||||
reline (>= 0.3.8)
|
reline (>= 0.3.8)
|
||||||
devise (4.9.4)
|
devise (5.0.3)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
railties (>= 4.1.0)
|
railties (>= 7.0)
|
||||||
responders
|
responders
|
||||||
warden (~> 1.2.3)
|
warden (~> 1.2.3)
|
||||||
drb (2.2.1)
|
devise-two-factor (6.4.0)
|
||||||
erubi (1.12.0)
|
activesupport (>= 7.2, < 8.2)
|
||||||
globalid (1.2.1)
|
devise (>= 4.0, < 6.0)
|
||||||
|
railties (>= 7.2, < 8.2)
|
||||||
|
rotp (~> 6.0)
|
||||||
|
drb (2.2.3)
|
||||||
|
erb (6.0.4)
|
||||||
|
erubi (1.13.1)
|
||||||
|
et-orbi (1.4.0)
|
||||||
|
tzinfo
|
||||||
|
ffi (1.17.4)
|
||||||
|
fugit (1.12.1)
|
||||||
|
et-orbi (~> 1.4)
|
||||||
|
raabro (~> 1.4)
|
||||||
|
globalid (1.3.0)
|
||||||
activesupport (>= 6.1)
|
activesupport (>= 6.1)
|
||||||
i18n (1.14.5)
|
i18n (1.14.8)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
importmap-rails (2.0.1)
|
image_processing (1.14.0)
|
||||||
|
mini_magick (>= 4.9.5, < 6)
|
||||||
|
ruby-vips (>= 2.0.17, < 3)
|
||||||
|
importmap-rails (2.2.3)
|
||||||
actionpack (>= 6.0.0)
|
actionpack (>= 6.0.0)
|
||||||
activesupport (>= 6.0.0)
|
activesupport (>= 6.0.0)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
io-console (0.7.2)
|
io-console (0.8.2)
|
||||||
irb (1.13.1)
|
irb (1.18.0)
|
||||||
|
pp (>= 0.6.0)
|
||||||
|
prism (>= 1.3.0)
|
||||||
rdoc (>= 4.0.0)
|
rdoc (>= 4.0.0)
|
||||||
reline (>= 0.4.2)
|
reline (>= 0.4.2)
|
||||||
jbuilder (2.12.0)
|
jbuilder (2.14.1)
|
||||||
actionview (>= 5.0.0)
|
actionview (>= 7.0.0)
|
||||||
activesupport (>= 5.0.0)
|
activesupport (>= 7.0.0)
|
||||||
loofah (2.22.0)
|
json (2.19.4)
|
||||||
|
language_server-protocol (3.17.0.5)
|
||||||
|
lint_roller (1.1.0)
|
||||||
|
logger (1.7.0)
|
||||||
|
loofah (2.25.1)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.12.0)
|
nokogiri (>= 1.12.0)
|
||||||
mail (2.8.1)
|
mail (2.9.0)
|
||||||
|
logger
|
||||||
mini_mime (>= 0.1.1)
|
mini_mime (>= 0.1.1)
|
||||||
net-imap
|
net-imap
|
||||||
net-pop
|
net-pop
|
||||||
net-smtp
|
net-smtp
|
||||||
marcel (1.0.4)
|
marcel (1.1.0)
|
||||||
matrix (0.4.2)
|
matrix (0.4.3)
|
||||||
|
mini_magick (5.3.1)
|
||||||
|
logger
|
||||||
mini_mime (1.1.5)
|
mini_mime (1.1.5)
|
||||||
mini_portile2 (2.8.6)
|
mini_portile2 (2.8.9)
|
||||||
minitest (5.22.3)
|
minitest (6.0.5)
|
||||||
msgpack (1.7.2)
|
drb (~> 2.0)
|
||||||
mutex_m (0.2.0)
|
prism (~> 1.5)
|
||||||
mysql2 (0.5.6)
|
msgpack (1.8.0)
|
||||||
net-imap (0.4.11)
|
mysql2 (0.5.7)
|
||||||
|
bigdecimal
|
||||||
|
net-imap (0.6.3)
|
||||||
date
|
date
|
||||||
net-protocol
|
net-protocol
|
||||||
net-pop (0.1.2)
|
net-pop (0.1.2)
|
||||||
net-protocol
|
net-protocol
|
||||||
net-protocol (0.2.2)
|
net-protocol (0.2.2)
|
||||||
timeout
|
timeout
|
||||||
net-smtp (0.5.0)
|
net-smtp (0.5.1)
|
||||||
net-protocol
|
net-protocol
|
||||||
nio4r (2.7.3)
|
nio4r (2.7.5)
|
||||||
nokogiri (1.16.5)
|
nokogiri (1.19.2)
|
||||||
mini_portile2 (~> 2.8.2)
|
mini_portile2 (~> 2.8.2)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
psych (5.1.2)
|
parallel (2.0.1)
|
||||||
|
parser (3.3.11.1)
|
||||||
|
ast (~> 2.4.1)
|
||||||
|
racc
|
||||||
|
pp (0.6.3)
|
||||||
|
prettyprint
|
||||||
|
prettyprint (0.2.0)
|
||||||
|
prism (1.9.0)
|
||||||
|
propshaft (1.3.2)
|
||||||
|
actionpack (>= 7.0.0)
|
||||||
|
activesupport (>= 7.0.0)
|
||||||
|
rack
|
||||||
|
psych (5.3.1)
|
||||||
|
date
|
||||||
stringio
|
stringio
|
||||||
public_suffix (5.0.5)
|
public_suffix (7.0.5)
|
||||||
puma (6.4.2)
|
puma (6.6.1)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
racc (1.7.3)
|
raabro (1.4.0)
|
||||||
rack (3.0.11)
|
racc (1.8.1)
|
||||||
rack-session (2.0.0)
|
rack (3.2.6)
|
||||||
|
rack-session (2.1.2)
|
||||||
|
base64 (>= 0.1.0)
|
||||||
rack (>= 3.0.0)
|
rack (>= 3.0.0)
|
||||||
rack-test (2.1.0)
|
rack-test (2.2.0)
|
||||||
rack (>= 1.3)
|
rack (>= 1.3)
|
||||||
rackup (2.1.0)
|
rackup (2.3.1)
|
||||||
rack (>= 3)
|
rack (>= 3)
|
||||||
webrick (~> 1.8)
|
rails (8.1.3)
|
||||||
rails (7.1.3.2)
|
actioncable (= 8.1.3)
|
||||||
actioncable (= 7.1.3.2)
|
actionmailbox (= 8.1.3)
|
||||||
actionmailbox (= 7.1.3.2)
|
actionmailer (= 8.1.3)
|
||||||
actionmailer (= 7.1.3.2)
|
actionpack (= 8.1.3)
|
||||||
actionpack (= 7.1.3.2)
|
actiontext (= 8.1.3)
|
||||||
actiontext (= 7.1.3.2)
|
actionview (= 8.1.3)
|
||||||
actionview (= 7.1.3.2)
|
activejob (= 8.1.3)
|
||||||
activejob (= 7.1.3.2)
|
activemodel (= 8.1.3)
|
||||||
activemodel (= 7.1.3.2)
|
activerecord (= 8.1.3)
|
||||||
activerecord (= 7.1.3.2)
|
activestorage (= 8.1.3)
|
||||||
activestorage (= 7.1.3.2)
|
activesupport (= 8.1.3)
|
||||||
activesupport (= 7.1.3.2)
|
|
||||||
bundler (>= 1.15.0)
|
bundler (>= 1.15.0)
|
||||||
railties (= 7.1.3.2)
|
railties (= 8.1.3)
|
||||||
rails-dom-testing (2.2.0)
|
rails-dom-testing (2.3.0)
|
||||||
activesupport (>= 5.0.0)
|
activesupport (>= 5.0.0)
|
||||||
minitest
|
minitest
|
||||||
nokogiri (>= 1.6)
|
nokogiri (>= 1.6)
|
||||||
rails-html-sanitizer (1.6.0)
|
rails-html-sanitizer (1.7.0)
|
||||||
loofah (~> 2.21)
|
loofah (~> 2.25)
|
||||||
nokogiri (~> 1.14)
|
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
||||||
railties (7.1.3.2)
|
railties (8.1.3)
|
||||||
actionpack (= 7.1.3.2)
|
actionpack (= 8.1.3)
|
||||||
activesupport (= 7.1.3.2)
|
activesupport (= 8.1.3)
|
||||||
irb
|
irb (~> 1.13)
|
||||||
rackup (>= 1.0.0)
|
rackup (>= 1.0.0)
|
||||||
rake (>= 12.2)
|
rake (>= 12.2)
|
||||||
thor (~> 1.0, >= 1.2.2)
|
thor (~> 1.0, >= 1.2.2)
|
||||||
|
tsort (>= 0.2)
|
||||||
zeitwerk (~> 2.6)
|
zeitwerk (~> 2.6)
|
||||||
rake (13.2.1)
|
rainbow (3.1.1)
|
||||||
rdoc (6.6.3.1)
|
rake (13.4.2)
|
||||||
|
rdoc (7.2.0)
|
||||||
|
erb
|
||||||
psych (>= 4.0.0)
|
psych (>= 4.0.0)
|
||||||
regexp_parser (2.9.1)
|
tsort
|
||||||
reline (0.5.7)
|
regexp_parser (2.12.0)
|
||||||
|
reline (0.6.3)
|
||||||
io-console (~> 0.5)
|
io-console (~> 0.5)
|
||||||
responders (3.1.1)
|
responders (3.2.0)
|
||||||
actionpack (>= 5.2)
|
actionpack (>= 7.0)
|
||||||
railties (>= 5.2)
|
railties (>= 7.0)
|
||||||
rexml (3.2.6)
|
rexml (3.4.4)
|
||||||
rubyzip (2.3.2)
|
rotp (6.3.0)
|
||||||
selenium-webdriver (4.20.1)
|
rqrcode (3.2.0)
|
||||||
|
chunky_png (~> 1.0)
|
||||||
|
rqrcode_core (~> 2.0)
|
||||||
|
rqrcode_core (2.1.0)
|
||||||
|
rubocop (1.86.1)
|
||||||
|
json (~> 2.3)
|
||||||
|
language_server-protocol (~> 3.17.0.2)
|
||||||
|
lint_roller (~> 1.1.0)
|
||||||
|
parallel (>= 1.10)
|
||||||
|
parser (>= 3.3.0.2)
|
||||||
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
|
regexp_parser (>= 2.9.3, < 3.0)
|
||||||
|
rubocop-ast (>= 1.49.0, < 2.0)
|
||||||
|
ruby-progressbar (~> 1.7)
|
||||||
|
unicode-display_width (>= 2.4.0, < 4.0)
|
||||||
|
rubocop-ast (1.49.1)
|
||||||
|
parser (>= 3.3.7.2)
|
||||||
|
prism (~> 1.7)
|
||||||
|
rubocop-performance (1.26.1)
|
||||||
|
lint_roller (~> 1.1)
|
||||||
|
rubocop (>= 1.75.0, < 2.0)
|
||||||
|
rubocop-ast (>= 1.47.1, < 2.0)
|
||||||
|
rubocop-rails (2.34.3)
|
||||||
|
activesupport (>= 4.2.0)
|
||||||
|
lint_roller (~> 1.1)
|
||||||
|
rack (>= 1.1)
|
||||||
|
rubocop (>= 1.75.0, < 2.0)
|
||||||
|
rubocop-ast (>= 1.44.0, < 2.0)
|
||||||
|
rubocop-rails-omakase (1.1.0)
|
||||||
|
rubocop (>= 1.72)
|
||||||
|
rubocop-performance (>= 1.24)
|
||||||
|
rubocop-rails (>= 2.30)
|
||||||
|
ruby-progressbar (1.13.0)
|
||||||
|
ruby-vips (2.3.0)
|
||||||
|
ffi (~> 1.12)
|
||||||
|
logger
|
||||||
|
rubyzip (3.2.2)
|
||||||
|
securerandom (0.4.1)
|
||||||
|
selenium-webdriver (4.43.0)
|
||||||
base64 (~> 0.2)
|
base64 (~> 0.2)
|
||||||
|
logger (~> 1.4)
|
||||||
rexml (~> 3.2, >= 3.2.5)
|
rexml (~> 3.2, >= 3.2.5)
|
||||||
rubyzip (>= 1.2.2, < 3.0)
|
rubyzip (>= 1.2.2, < 4.0)
|
||||||
websocket (~> 1.0)
|
websocket (~> 1.0)
|
||||||
sprockets (4.2.1)
|
solid_cable (3.0.12)
|
||||||
|
actioncable (>= 7.2)
|
||||||
|
activejob (>= 7.2)
|
||||||
|
activerecord (>= 7.2)
|
||||||
|
railties (>= 7.2)
|
||||||
|
solid_cache (1.0.10)
|
||||||
|
activejob (>= 7.2)
|
||||||
|
activerecord (>= 7.2)
|
||||||
|
railties (>= 7.2)
|
||||||
|
solid_queue (1.4.0)
|
||||||
|
activejob (>= 7.1)
|
||||||
|
activerecord (>= 7.1)
|
||||||
|
concurrent-ruby (>= 1.3.1)
|
||||||
|
fugit (~> 1.11)
|
||||||
|
railties (>= 7.1)
|
||||||
|
thor (>= 1.3.1)
|
||||||
|
sprockets (4.2.2)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
|
logger
|
||||||
rack (>= 2.2.4, < 4)
|
rack (>= 2.2.4, < 4)
|
||||||
sprockets-rails (3.4.2)
|
sprockets-rails (3.5.2)
|
||||||
actionpack (>= 5.2)
|
actionpack (>= 6.1)
|
||||||
activesupport (>= 5.2)
|
activesupport (>= 6.1)
|
||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
stimulus-rails (1.3.3)
|
stimulus-rails (1.3.4)
|
||||||
railties (>= 6.0.0)
|
|
||||||
stringio (3.1.0)
|
|
||||||
thor (1.3.1)
|
|
||||||
timeout (0.4.1)
|
|
||||||
turbo-rails (2.0.5)
|
|
||||||
actionpack (>= 6.0.0)
|
|
||||||
activejob (>= 6.0.0)
|
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
|
stringio (3.2.0)
|
||||||
|
thor (1.5.0)
|
||||||
|
thruster (0.1.20)
|
||||||
|
timeout (0.6.1)
|
||||||
|
tsort (0.2.0)
|
||||||
|
turbo-rails (2.0.23)
|
||||||
|
actionpack (>= 7.1.0)
|
||||||
|
railties (>= 7.1.0)
|
||||||
tzinfo (2.0.6)
|
tzinfo (2.0.6)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
|
unicode-display_width (3.2.0)
|
||||||
|
unicode-emoji (~> 4.1)
|
||||||
|
unicode-emoji (4.2.0)
|
||||||
|
uri (1.1.1)
|
||||||
|
useragent (0.16.11)
|
||||||
warden (1.2.9)
|
warden (1.2.9)
|
||||||
rack (>= 2.0.9)
|
rack (>= 2.0.9)
|
||||||
web-console (4.2.1)
|
web-console (4.3.0)
|
||||||
actionview (>= 6.0.0)
|
actionview (>= 8.0.0)
|
||||||
activemodel (>= 6.0.0)
|
|
||||||
bindex (>= 0.4.0)
|
bindex (>= 0.4.0)
|
||||||
railties (>= 6.0.0)
|
railties (>= 8.0.0)
|
||||||
webdrivers (5.2.0)
|
websocket (1.2.11)
|
||||||
nokogiri (~> 1.6)
|
websocket-driver (0.8.0)
|
||||||
rubyzip (>= 1.3.0)
|
base64
|
||||||
selenium-webdriver (~> 4.0)
|
|
||||||
webrick (1.8.1)
|
|
||||||
websocket (1.2.10)
|
|
||||||
websocket-driver (0.7.6)
|
|
||||||
websocket-extensions (>= 0.1.0)
|
websocket-extensions (>= 0.1.0)
|
||||||
websocket-extensions (0.1.5)
|
websocket-extensions (0.1.5)
|
||||||
xpath (3.2.0)
|
xpath (3.2.0)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
zeitwerk (2.6.14)
|
zeitwerk (2.7.5)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
x86_64-openbsd
|
x86_64-openbsd
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
bootsnap
|
bootsnap
|
||||||
capybara
|
brakeman
|
||||||
|
bundler-audit
|
||||||
|
capybara (~> 3.40)
|
||||||
debug
|
debug
|
||||||
devise
|
devise
|
||||||
|
devise-two-factor
|
||||||
|
image_processing (~> 1.2)
|
||||||
importmap-rails
|
importmap-rails
|
||||||
jbuilder
|
jbuilder
|
||||||
mysql2 (~> 0.5)
|
mysql2 (~> 0.5)
|
||||||
|
propshaft
|
||||||
puma (~> 6.0)
|
puma (~> 6.0)
|
||||||
rails (= 7.1.3.2)
|
rails (= 8.1.3)
|
||||||
selenium-webdriver
|
rqrcode
|
||||||
|
rubocop-rails-omakase
|
||||||
|
selenium-webdriver (~> 4.43)
|
||||||
|
solid_cable
|
||||||
|
solid_cache
|
||||||
|
solid_queue
|
||||||
sprockets-rails
|
sprockets-rails
|
||||||
stimulus-rails
|
stimulus-rails
|
||||||
|
thruster
|
||||||
turbo-rails
|
turbo-rails
|
||||||
tzinfo-data
|
tzinfo-data
|
||||||
web-console
|
web-console
|
||||||
webdrivers
|
|
||||||
|
|
||||||
RUBY VERSION
|
RUBY VERSION
|
||||||
ruby 3.3.1p55
|
ruby 4.0.2p0
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.3.26
|
2.3.26
|
||||||
|
|||||||
43
README.md
43
README.md
@@ -1,10 +1,32 @@
|
|||||||
|
# DO NOT USE - still working on it.
|
||||||
|
|
||||||
# Ruby on Rails front end for OpenSMTPD.
|
# Ruby on Rails front end for OpenSMTPD.
|
||||||
|
|
||||||
An ISC Licensed RoR app to manage your OpenSMTPD users.
|
An ISC Licensed RoR app to manage your OpenSMTPD users.
|
||||||
|
|
||||||
## OpenBSD Instructions.
|
## OpenBSD Instructions.
|
||||||
|
|
||||||
doas pkg_add
|
```
|
||||||
|
doas pkg_add ruby
|
||||||
|
|
||||||
|
ln -sf /usr/local/bin/ruby40 /usr/local/bin/ruby
|
||||||
|
ln -sf /usr/local/bin/bundle40 /usr/local/bin/bundle
|
||||||
|
ln -sf /usr/local/bin/bundler40 /usr/local/bin/bundler
|
||||||
|
ln -sf /usr/local/bin/erb40 /usr/local/bin/erb
|
||||||
|
ln -sf /usr/local/bin/gem40 /usr/local/bin/gem
|
||||||
|
ln -sf /usr/local/bin/irb40 /usr/local/bin/irb
|
||||||
|
ln -sf /usr/local/bin/minitest40 /usr/local/bin/minitest
|
||||||
|
ln -sf /usr/local/bin/racc40 /usr/local/bin/racc
|
||||||
|
ln -sf /usr/local/bin/rake40 /usr/local/bin/rake
|
||||||
|
ln -sf /usr/local/bin/rbs40 /usr/local/bin/rbs
|
||||||
|
ln -sf /usr/local/bin/rdbg40 /usr/local/bin/rdbg
|
||||||
|
ln -sf /usr/local/bin/rdoc40 /usr/local/bin/rdoc
|
||||||
|
ln -sf /usr/local/bin/ri40 /usr/local/bin/ri
|
||||||
|
ln -sf /usr/local/bin/syntax_suggest40 /usr/local/bin/syntax_suggest
|
||||||
|
ln -sf /usr/local/bin/test-unit40 /usr/local/bin/test-unit
|
||||||
|
ln -sf /usr/local/bin/typeprof40 /usr/local/bin/typeprof
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
## Database schema
|
## Database schema
|
||||||
Is derived from https://github.com/OpenSMTPD/OpenSMTPD-extras/blob/master/extras/tables/table-mysql/table-mysql.5
|
Is derived from https://github.com/OpenSMTPD/OpenSMTPD-extras/blob/master/extras/tables/table-mysql/table-mysql.5
|
||||||
@@ -12,9 +34,9 @@ Is derived from https://github.com/OpenSMTPD/OpenSMTPD-extras/blob/master/extras
|
|||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
* Ruby version - 3.2.3
|
* Ruby version - 4.0.2
|
||||||
|
|
||||||
* Rails 7.1.3
|
* Rails 8.1.3
|
||||||
|
|
||||||
* System dependencies
|
* System dependencies
|
||||||
|
|
||||||
@@ -22,7 +44,19 @@ Is derived from https://github.com/OpenSMTPD/OpenSMTPD-extras/blob/master/extras
|
|||||||
|
|
||||||
* Database creation
|
* Database creation
|
||||||
|
|
||||||
|
```
|
||||||
|
CREATE USER 'OpenSMTPD'@'localhost' IDENTIFIED BY 'password';
|
||||||
|
CREATE DATABASE OpenSMTPD;
|
||||||
|
GRANT ALL PRIVILEGES ON OpenSMTPD.* TO 'OpenSMTPD'@'localhost';
|
||||||
|
FLUSH PRIVILEGES;
|
||||||
|
```
|
||||||
|
|
||||||
* Database initialization
|
* Database initialization
|
||||||
|
```
|
||||||
|
RAILS_ENV=production rails db:migrate
|
||||||
|
|
||||||
|
RAILS_ENV=production rails console
|
||||||
|
```
|
||||||
|
|
||||||
* How to run the test suite
|
* How to run the test suite
|
||||||
|
|
||||||
@@ -30,12 +64,13 @@ Is derived from https://github.com/OpenSMTPD/OpenSMTPD-extras/blob/master/extras
|
|||||||
|
|
||||||
* Deployment instructions
|
* Deployment instructions
|
||||||
|
|
||||||
|
You will need to create an admin user using the Rails Console:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Licensed
|
## Licensed
|
||||||
|
|
||||||
Copyright 2022 - 2023 Jez Caudle
|
Copyright 2022 - 2026 Jez Caudle
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,69 @@
|
|||||||
*= require_self
|
*= require_self
|
||||||
*/
|
*/
|
||||||
|
|
||||||
body, nav, main, footer {
|
/*
|
||||||
padding: 1rem;
|
* https://github.com/Lazzzer00/Best-CSS-Reset-2024
|
||||||
margin: 1rem;
|
*/
|
||||||
|
*, *::before, *::after{
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*{
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul[role='list'], ol[role='list']{
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
html:focus-within{
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:not([class]){
|
||||||
|
text-decoration-skip-ink: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
img, picture, svg, video, canvas{
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
vertical-align: middle;
|
||||||
|
font-style: italic;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
input, button, textarea, select{
|
||||||
|
font: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce){
|
||||||
|
html:focus-within {
|
||||||
|
scroll-behavior: auto;
|
||||||
|
}
|
||||||
|
*, *::before, *::after {
|
||||||
|
animation-duration: 0.01ms !important;
|
||||||
|
animation-iteration-count: 1 !important;
|
||||||
|
transition-duration: 0.01ms !important;
|
||||||
|
scroll-behavior: auto !important;
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
body, html{
|
||||||
|
height: 100%;
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
padding:1rem;
|
||||||
|
font-family:sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Other CSS
|
||||||
|
*/
|
||||||
|
|
||||||
menu {
|
menu {
|
||||||
display: flex;
|
display: flex;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
@@ -32,36 +90,81 @@ menu > li {
|
|||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
main, .flash {
|
||||||
|
background-color: #efefef;
|
||||||
|
border-radius:1rem;
|
||||||
|
padding:1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flash {
|
||||||
|
background-color: #dfcedf;
|
||||||
|
margin-bottom:1rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.domain-header, .mfa-header, h2 {
|
||||||
|
background-color: #fefefe;
|
||||||
|
border-radius:1rem;
|
||||||
|
padding:1rem 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.domain-header h2 {
|
.domain-header h2 {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.domain-header a {
|
.domain-header a {
|
||||||
font-size: 9pt;
|
scale: 75%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.domain-header button {
|
.email-list, .domain-list, .mfa-list, .work-area {
|
||||||
margin:0 0 0 10px;
|
border-radius:1rem;
|
||||||
|
border:1rem black;
|
||||||
|
background-color:#e7eae7;
|
||||||
|
padding:2rem;
|
||||||
|
margin:1rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.work-area input {
|
||||||
|
padding:0.5rem;
|
||||||
|
margin:0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.work-area label {
|
||||||
|
padding:0.5rem;
|
||||||
|
margin:0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.email-list li {
|
.email-list li {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin:0.3rem 1rem;
|
margin:0.3rem 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.email-list li a {
|
.email-list li a {
|
||||||
padding:0 10px;
|
padding:0 0.3rem;
|
||||||
}
|
|
||||||
|
|
||||||
main, body {
|
|
||||||
padding:1rem;
|
|
||||||
margin:1rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
|
margin-top:1rem;
|
||||||
background-color:#efefef;
|
background-color:#efefef;
|
||||||
margin:0 1rem;
|
|
||||||
padding:1rem;
|
padding:1rem;
|
||||||
border-radius:1rem;
|
border-radius:1rem;
|
||||||
|
text-align:center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
footer ul, footer h3 , footer li {
|
||||||
|
margin:10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a, a:visited {
|
||||||
|
color:blue;
|
||||||
|
text-decoration:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color:red;
|
||||||
|
background-color:yellow;
|
||||||
|
text-decoration:underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
|
before_action :configure_permitted_parameters, if: :devise_controller?
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def configure_permitted_parameters
|
||||||
|
devise_parameter_sanitizer.permit(:sign_in, keys: [:otp_attempt])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -36,8 +36,21 @@ class DomainsController < ApplicationController
|
|||||||
|
|
||||||
# PATCH/PUT /domains/1 or /domains/1.json
|
# PATCH/PUT /domains/1 or /domains/1.json
|
||||||
def update
|
def update
|
||||||
|
pre_domain_name = @domain.domain
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @domain.update(domain_params)
|
if @domain.update(domain_params)
|
||||||
|
# now we need to update the credentials and virtuals
|
||||||
|
|
||||||
|
@domain.credentials.each do |credential|
|
||||||
|
credential.email.sub! pre_domain_name, @domain.domain
|
||||||
|
credential.save
|
||||||
|
end
|
||||||
|
|
||||||
|
@domain.virtuals.each do |virtual|
|
||||||
|
virtual.email.sub! pre_domain_name, @domain.domain
|
||||||
|
virtual.save
|
||||||
|
end
|
||||||
|
|
||||||
format.html { redirect_to domain_url(@domain), notice: "Domain was successfully updated." }
|
format.html { redirect_to domain_url(@domain), notice: "Domain was successfully updated." }
|
||||||
format.json { render :show, status: :ok, location: @domain }
|
format.json { render :show, status: :ok, location: @domain }
|
||||||
else
|
else
|
||||||
|
|||||||
22
app/controllers/mfas_controller.rb
Normal file
22
app/controllers/mfas_controller.rb
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
class MfasController < ApplicationController
|
||||||
|
def new
|
||||||
|
issuer = "Hidden Agenda Email"
|
||||||
|
label = "#{issuer}:#{current_user.email}"
|
||||||
|
if current_user.otp_secret.to_s.length == 0
|
||||||
|
current_user.otp_secret = User.generate_otp_secret
|
||||||
|
current_user.save!
|
||||||
|
end
|
||||||
|
|
||||||
|
qrcode = RQRCode::QRCode.new([{ data: current_user.otp_provisioning_uri(label, issuer: issuer), mode: :byte_8bit }])
|
||||||
|
|
||||||
|
@svg = qrcode.as_svg(color: "000", shape_rendering: "crispEdges", module_size: 5, standalone: true,
|
||||||
|
use_path: true
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
current_user.otp_required_for_login = true
|
||||||
|
current_user.save!
|
||||||
|
redirect_to root_url
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -5,6 +5,7 @@ class Domain < ApplicationRecord
|
|||||||
has_many :virtuals, dependent: :destroy
|
has_many :virtuals, dependent: :destroy
|
||||||
validates :domain, presence: true
|
validates :domain, presence: true
|
||||||
validates :domain, uniqueness: true
|
validates :domain, uniqueness: true
|
||||||
|
validates :domain, format: { with: /\A(((?!-))(xn--|_)?[a-z0-9-]{0,61}[a-z0-9]{1,1}\.)*(xn--)?([a-z0-9][a-z0-9\-]{0,60}|[a-z0-9-]{1,30}\.[a-z]{2,})\z/, message: "domain not valid" }
|
||||||
|
|
||||||
private
|
private
|
||||||
def create_abuse_postmaster
|
def create_abuse_postmaster
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
class User < ApplicationRecord
|
class User < ApplicationRecord
|
||||||
|
devise :two_factor_authenticatable
|
||||||
# Include default devise modules. Others available are:
|
# Include default devise modules. Others available are:
|
||||||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
||||||
devise :database_authenticatable, :recoverable, :rememberable, :validatable, :lockable, :timeoutable, :trackable, :registerable
|
devise :recoverable, :rememberable, :validatable, :lockable, :timeoutable, :trackable, :registerable
|
||||||
|
|
||||||
|
def role
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<%= form_with(model: [@domain, credential]) do |form| %>
|
<%= form_with(model: [@domain, credential], html: { class: "work-area"}) do |form| %>
|
||||||
<% if credential.errors.any? %>
|
<% if credential.errors.any? %>
|
||||||
<div style="color: red">
|
<div style="color: red">
|
||||||
<h2><%= pluralize(credential.errors.count, "error") %> prohibited this credential from being saved:</h2>
|
<h2><%= pluralize(credential.errors.count, "error") %> prohibited this credential from being saved:</h2>
|
||||||
@@ -11,17 +11,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div>
|
<%= form.label :email %>:<%= form.text_field :email %>@<%=@domain.domain%>
|
||||||
<%= form.label :email, style: "display: inline" %> @<%=@domain.domain%>
|
<br/>
|
||||||
<%= form.text_field :email %>
|
<%= form.label :password %>:<%= form.text_field :password %>
|
||||||
</div>
|
<br/>
|
||||||
|
|
||||||
<div>
|
|
||||||
<%= form.label :password, style: "display: block" %>
|
|
||||||
<%= form.text_field :password %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<%= form.submit "Create email" %>
|
||||||
<%= form.submit %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
<h1>New credential</h1>
|
<h2>New email for <%= @domain.domain %></h2>
|
||||||
|
|
||||||
<%= render "form", credential: @credential %>
|
<%= render "form", credential: @credential %>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div>
|
|
||||||
<%= link_to "Back to the domain", domain_path(@domain) %>
|
<%= link_to "Back to the domain", domain_path(@domain) %>
|
||||||
</div>
|
|
||||||
|
|||||||
@@ -21,5 +21,5 @@
|
|||||||
<%= f.submit "Change my password" %>
|
<%= f.submit "Change my password" %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<hr/>
|
||||||
<%= render "devise/shared/links" %>
|
<%#= render "devise/shared/links" %>
|
||||||
|
|||||||
@@ -1,39 +1,34 @@
|
|||||||
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
||||||
|
|
||||||
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
|
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, class: 'work-area' }) do |f| %>
|
||||||
<%= render "devise/shared/error_messages", resource: resource %>
|
<%= render "devise/shared/error_messages", resource: resource %>
|
||||||
|
|
||||||
<div class="field">
|
<%= f.label :email %>:<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
||||||
<%= f.label :email %><br />
|
|
||||||
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
||||||
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
|
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class="field">
|
|
||||||
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
|
|
||||||
<%= f.password_field :password, autocomplete: "new-password" %>
|
|
||||||
<% if @minimum_password_length %>
|
|
||||||
<br/>
|
<br/>
|
||||||
<em><%= @minimum_password_length %> characters minimum</em>
|
<%= f.label :password %>:<%= f.password_field :password, autocomplete: "new-password" %>
|
||||||
<% end %>
|
<% if @minimum_password_length %><em><%= @minimum_password_length %> characters minimum</em><% end %> <i>(leave blank if you don't want to change it)</i>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field">
|
<br/>
|
||||||
<%= f.label :password_confirmation %><br />
|
<%= f.label :password_confirmation %>:<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
|
||||||
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field">
|
<br/>
|
||||||
<%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
<%= f.label :current_password %>:<%= f.password_field :current_password, autocomplete: "current-password" %>
|
||||||
<%= f.password_field :current_password, autocomplete: "current-password" %>
|
<br/><i>(we need your current password to confirm your changes)</i>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="actions">
|
<br/>
|
||||||
<%= f.submit "Update" %>
|
<%= f.submit "Update" %>
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
<% if current_user.otp_secret.to_s.size == 0 %>
|
||||||
|
<%= link_to "Enable MFA", new_mfa_path %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to "Edit MFA", new_mfa_path %>
|
||||||
|
<% end %>
|
||||||
|
|
|
||||||
<%= link_to "Back", :back %>
|
<%= link_to "Back", :back %>
|
||||||
|
|||||||
@@ -1,27 +1,22 @@
|
|||||||
<h2>Log in</h2>
|
<h2>Log in</h2>
|
||||||
|
|
||||||
<div class="black asap m-l3">
|
|
||||||
<%= form_for(resource, as: resource_name, url: session_path(resource_name), class: "p-10 border shadow br-b-8 md-w-50pc mx-auto") do |f| %>
|
|
||||||
<div class="flex flex-column">
|
|
||||||
<%= f.label :email, class: "my-2" %>
|
|
||||||
<%= f.email_field :email, autofocus: true, autocomplete: "email", class:"input" %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-column mt-3">
|
<%= form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: "work-area" } ) do |f| %>
|
||||||
<%= f.label :password, class: "my-2" %>
|
|
||||||
<%= f.password_field :password, autocomplete: "current-password", class: "input" %>
|
<%= f.label :email %>:<%= f.email_field :email, autofocus: true, autocomplete: "email", class:"input" %>
|
||||||
</div>
|
<br/>
|
||||||
|
<%= f.label :password %>:<%= f.password_field :password, autocomplete: "current-password", class: "input" %>
|
||||||
|
<br/>
|
||||||
|
<%= f.label :otp_attempt %>:<%= f.password_field :otp_attempt, autocomplete: "OTP Code", class: "input" %>
|
||||||
|
<br/>
|
||||||
|
|
||||||
<% if devise_mapping.rememberable? %>
|
<% if devise_mapping.rememberable? %>
|
||||||
<div class="flex flex-items-center mt-4">
|
<%= f.label :remember_me %><%= f.check_box :remember_me %>
|
||||||
<%= f.check_box :remember_me, class: "checkbox mr-3" %>
|
|
||||||
<%= f.label :remember_me, class: "form-check-label" %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class="mt-4">
|
<br/>
|
||||||
<%= f.submit "Log in", class: "button" %>
|
<%= f.submit "Log in", class: "button" %>
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
|
||||||
<%= render "devise/shared/links" %>
|
<%= render "devise/shared/links" %>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<%= form_with(model: domain) do |form| %>
|
<%= form_with(model: domain, html: { class: "work-area" }) do |form| %>
|
||||||
<% if domain.errors.any? %>
|
<% if domain.errors.any? %>
|
||||||
<div style="color: red">
|
<div style="color: red">
|
||||||
<h2><%= pluralize(domain.errors.count, "error") %> prohibited this domain from being saved:</h2>
|
<h2><%= pluralize(domain.errors.count, "error") %> prohibited this domain from being saved:</h2>
|
||||||
@@ -12,11 +12,13 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<%= form.label :domain, style: "display: block" %>
|
<%= form.label :domain %>:<%= form.text_field :domain %>
|
||||||
<%= form.text_field :domain %>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<%= form.submit %>
|
<%= form.submit %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
<div class="domain">
|
||||||
|
|
||||||
<h1>Editing domain</h1>
|
<h1>Editing domain</h1>
|
||||||
|
|
||||||
<%= render "form", domain: @domain %>
|
<%= render "form", domain: @domain %>
|
||||||
@@ -5,6 +7,8 @@
|
|||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<%= link_to "Show this domain", @domain %> |
|
<%= link_to "Back", @domain %> |
|
||||||
<%= link_to "Back to domains", domains_path %>
|
<%= link_to "Home", domains_path %>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
<h1>Domains <%= link_to "Add new domain",new_domain_path %> </h1>
|
<div class="domain">
|
||||||
|
<div class="domain-header">
|
||||||
|
<h2>Domains <%= link_to "Add new domain",new_domain_path %></h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="domains">
|
<div class="domain-list">
|
||||||
<ul>
|
<ul><% @domains.each do |domain| %>
|
||||||
<% @domains.each do |domain| %>
|
|
||||||
<li><%= link_to domain.domain, domain %></li>
|
<li><%= link_to domain.domain, domain %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<h1>New domain</h1>
|
<h2>New domain</h2>
|
||||||
|
|
||||||
<%= render "form", domain: @domain %>
|
<%= render "form", domain: @domain %>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div>
|
|
||||||
<%= link_to "Back to domains", domains_path %>
|
<%= link_to "Back to domains", domains_path %>
|
||||||
</div>
|
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
<div>
|
<div class="domain">
|
||||||
<div class="domain-header">
|
<div class="domain-header">
|
||||||
<h2><%= @domain.domain %> <%#= link_to "Edit", edit_domain_path(@domain) %> <%= button_to "Delete", @domain, method: :delete %></h2>
|
<h2><%= @domain.domain %> <%= link_to "Edit", edit_domain_path(@domain) %> <%= link_to "Delete", @domain, data: { turbo_method: :delete, turbo_confirm: "Are you sure?"} %></h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="email-list">
|
<div class="email-list">
|
||||||
<h3>Credentials (<%= @domain.credentials.count %>) <%= link_to "Add #{@domain.domain} email address", new_domain_credential_path(@domain) %></h2>
|
<h3>Credentials (<%= @domain.credentials.count %>) <%= link_to "Add #{@domain.domain} email address", new_domain_credential_path(@domain) %></h3>
|
||||||
<ul>
|
<ul>
|
||||||
<% @domain.credentials.each do |credential| %>
|
<% @domain.credentials.each do |credential| %>
|
||||||
<li><%= credential.email %> <%= link_to "Edit", edit_domain_credential_path(@domain,credential) %> <%= button_to "Delete this email address", [@domain, credential], method: :delete %></li>
|
<li><%= credential.email %> <%= link_to "Edit", edit_domain_credential_path(@domain,credential) %> <%= link_to "Delete this email address", [@domain, credential], data: { turbo_method: :delete, turbo_confirm: "Are you sure?"} %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
|
<div class="email-list">
|
||||||
<h3>Virtuals (<%= @domain.virtuals.count %>) <%= link_to "Add #{@domain.domain} virtual email", new_domain_virtual_path(@domain) %></h2>
|
<h3>Virtuals (<%= @domain.virtuals.count %>) <%= link_to "Add #{@domain.domain} virtual email", new_domain_virtual_path(@domain) %></h3>
|
||||||
<ul>
|
<ul>
|
||||||
<% @domain.virtuals.each do |virtual| %>
|
<% @domain.virtuals.each do |virtual| %>
|
||||||
<li><%= virtual.email%> >> <%= virtual.destination%> <%= link_to "Edit", edit_domain_virtual_path(@domain,virtual)%> <%= button_to "Delete", [@domain, virtual], method: :delete, style: "display:inline" %></li>
|
<li><%= virtual.email%> >> <%= virtual.destination%> <%= link_to "Edit", edit_domain_virtual_path(@domain,virtual)%> <%= link_to "Delete", [@domain, virtual], data: { turbo_method: :delete, turbo_confirm: "Are you sure?"} %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|||||||
@@ -19,22 +19,26 @@
|
|||||||
<br/>
|
<br/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<% if notice %><div class="flash"><%= notice %></div><% end %><% if alert %><div class="flash"><%= alert %></div><% end %>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<% if notice %><div class="bg-green-lightest green-darkest px-5 py-3 br-3 border-l bw-6 bc-green"><%= notice %></div><% end %>
|
|
||||||
<% if alert %><div class="bg-red-lightest red-darkest px-5 py-3 br-3 border-l bw-6 bc-red"><%= alert %></div><% end %>
|
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
</main>
|
</main>
|
||||||
|
<% if Rails.env == "development" %>
|
||||||
<footer>
|
<footer>
|
||||||
<hr/>
|
|
||||||
RoR Version <%= Rails.version %> (<%=Rails.env%>) | Ruby <%= "#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}" %> | OS <%= RUBY_PLATFORM %> | App Version <%= `git describe --always` %>
|
RoR Version <%= Rails.version %> (<%=Rails.env%>) | Ruby <%= "#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}" %> | OS <%= RUBY_PLATFORM %> | App Version <%= `git describe --always` %>
|
||||||
|
|
||||||
|
<% if user_signed_in? %>
|
||||||
<hr/>
|
<hr/>
|
||||||
|
<%= "User:#{current_user.email} | OTP for login:#{current_user.otp_required_for_login} | " %>
|
||||||
|
<% end %>
|
||||||
|
<!--
|
||||||
<h3>To-Do (In order of importance):</h3>
|
<h3>To-Do (In order of importance):</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Tests for controllers and integration</li>
|
|
||||||
<li>2FA</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
-->
|
||||||
|
<% end %>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
9
app/views/mfas/new.html.erb
Normal file
9
app/views/mfas/new.html.erb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<div class="mfa">
|
||||||
|
<h1 class="mfa-header">New MFA</h1>
|
||||||
|
<div class="mfa-list">
|
||||||
|
<p>Scan the code below and then click "Done".</p>
|
||||||
|
<p>You will only be able to login with your authenticator app once you have clicked "Done"</p>
|
||||||
|
<%= @svg.html_safe%>
|
||||||
|
<p><%= link_to "Done", mfas_path, data: { turbo_method: :post} %></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<%= form_with(model: [@domain,virtual]) do |form| %>
|
<%= form_with(model: [@domain,virtual], html: { class: "work-area"}) do |form| %>
|
||||||
<% if virtual.errors.any? %>
|
<% if virtual.errors.any? %>
|
||||||
<div style="color: red">
|
<div style="color: red">
|
||||||
<h2><%= pluralize(virtual.errors.count, "error") %> prohibited this virtual from being saved:</h2>
|
<h2><%= pluralize(virtual.errors.count, "error") %> prohibited this virtual from being saved:</h2>
|
||||||
@@ -11,17 +11,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div>
|
<%= form.label :email%>:<%= form.text_field :email %>@<%=@domain.domain%>
|
||||||
<%= form.label :email, style: "display: block" %>
|
<br/>
|
||||||
<%= form.text_field :email %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<%= form.label :destination %>:<%= form.text_field :destination %>
|
||||||
<%= form.label :destination, style: "display: block" %>
|
<br/>
|
||||||
<%= form.text_field :destination %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<%= form.submit %>
|
<%= form.submit %>
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
<h1>New virtual for <%= @domain.domain %></h1>
|
<h2>New virtual for <%= @domain.domain %></h2>
|
||||||
|
|
||||||
<%= render "form", virtual: @virtual %>
|
<%= render "form", virtual: @virtual %>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div>
|
|
||||||
<%= link_to "Back to #{@domain.domain}", domain_path(@domain) %>
|
<%= link_to "Back to #{@domain.domain}", domain_path(@domain) %>
|
||||||
</div>
|
|
||||||
|
|||||||
7
bin/brakeman
Executable file
7
bin/brakeman
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
require "rubygems"
|
||||||
|
require "bundler/setup"
|
||||||
|
|
||||||
|
ARGV.unshift("--ensure-latest")
|
||||||
|
|
||||||
|
load Gem.bin_path("brakeman", "brakeman")
|
||||||
6
bin/bundler-audit
Executable file
6
bin/bundler-audit
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
require_relative "../config/boot"
|
||||||
|
require "bundler/audit/cli"
|
||||||
|
|
||||||
|
ARGV.concat %w[ --config config/bundler-audit.yml ] if ARGV.empty? || ARGV.include?("check")
|
||||||
|
Bundler::Audit::CLI.start
|
||||||
6
bin/ci
Executable file
6
bin/ci
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
require_relative "../config/boot"
|
||||||
|
require "active_support/continuous_integration"
|
||||||
|
|
||||||
|
CI = ActiveSupport::ContinuousIntegration
|
||||||
|
require_relative "../config/ci.rb"
|
||||||
2
bin/dev
Executable file
2
bin/dev
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
exec "./bin/rails", "server", *ARGV
|
||||||
8
bin/docker-entrypoint
Executable file
8
bin/docker-entrypoint
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
# If running the rails server then create or migrate existing database
|
||||||
|
if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
|
||||||
|
./bin/rails db:prepare
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "${@}"
|
||||||
8
bin/rubocop
Executable file
8
bin/rubocop
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
require "rubygems"
|
||||||
|
require "bundler/setup"
|
||||||
|
|
||||||
|
# Explicit RuboCop config increases performance slightly while avoiding config confusion.
|
||||||
|
ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
|
||||||
|
|
||||||
|
load Gem.bin_path("rubocop", "rubocop")
|
||||||
12
bin/setup
12
bin/setup
@@ -1,11 +1,10 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
require "fileutils"
|
require "fileutils"
|
||||||
|
|
||||||
# path to your application root.
|
|
||||||
APP_ROOT = File.expand_path("..", __dir__)
|
APP_ROOT = File.expand_path("..", __dir__)
|
||||||
|
|
||||||
def system!(*args)
|
def system!(*args)
|
||||||
system(*args) || abort("\n== Command #{args} failed ==")
|
system(*args, exception: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
FileUtils.chdir APP_ROOT do
|
FileUtils.chdir APP_ROOT do
|
||||||
@@ -14,7 +13,6 @@ FileUtils.chdir APP_ROOT do
|
|||||||
# Add necessary setup steps to this file.
|
# Add necessary setup steps to this file.
|
||||||
|
|
||||||
puts "== Installing dependencies =="
|
puts "== Installing dependencies =="
|
||||||
system! "gem install bundler --conservative"
|
|
||||||
system("bundle check") || system!("bundle install")
|
system("bundle check") || system!("bundle install")
|
||||||
|
|
||||||
# puts "\n== Copying sample files =="
|
# puts "\n== Copying sample files =="
|
||||||
@@ -24,10 +22,14 @@ FileUtils.chdir APP_ROOT do
|
|||||||
|
|
||||||
puts "\n== Preparing database =="
|
puts "\n== Preparing database =="
|
||||||
system! "bin/rails db:prepare"
|
system! "bin/rails db:prepare"
|
||||||
|
system! "bin/rails db:reset" if ARGV.include?("--reset")
|
||||||
|
|
||||||
puts "\n== Removing old logs and tempfiles =="
|
puts "\n== Removing old logs and tempfiles =="
|
||||||
system! "bin/rails log:clear tmp:clear"
|
system! "bin/rails log:clear tmp:clear"
|
||||||
|
|
||||||
puts "\n== Restarting application server =="
|
unless ARGV.include?("--skip-server")
|
||||||
system! "bin/rails restart"
|
puts "\n== Starting development server =="
|
||||||
|
STDOUT.flush # flush the output before exec(2) so that it displays
|
||||||
|
exec "bin/dev"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
5
bin/thrust
Executable file
5
bin/thrust
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
require "rubygems"
|
||||||
|
require "bundler/setup"
|
||||||
|
|
||||||
|
load Gem.bin_path("thruster", "thrust")
|
||||||
@@ -9,7 +9,8 @@ Bundler.require(*Rails.groups)
|
|||||||
module OpensmtpdRailsFrontend
|
module OpensmtpdRailsFrontend
|
||||||
class Application < Rails::Application
|
class Application < Rails::Application
|
||||||
# Initialize configuration defaults for originally generated Rails version.
|
# Initialize configuration defaults for originally generated Rails version.
|
||||||
config.load_defaults 7.0
|
config.load_defaults 8.1
|
||||||
|
config.autoload_lib(ignore: %w[assets tasks])
|
||||||
|
|
||||||
# Configuration for the application, engines, and railties goes here.
|
# Configuration for the application, engines, and railties goes here.
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
RYdwaEGe4bkkqfzKaJgRzzktgKS227tgbhMhGS1aSa69LRZauHIiIBnqQSOSNrRftPa65+QkuSTToq7VvQklLwUPDluIXOudx/IxCjvnmjoVdkBDPFzCIJhM01eD4ZKje6cqTIMQqVCAlZ0dCHuOrdLaU4TiH9qqKN9KqoKfrV9O8IXVV0x7xt8um1KDyT7XQ/JQS6ggmSbiqvkNhwuflgrYJFzMfX4/glcCTSviFzhW0ri4XOA6LYnQhYF6ed8z/mNaiVM1Q2yBspVNIxCFwQEs8kF/VWmVjSUdPFExR3Tt0j/w7zc4e9LlxbHvPcJg43f6de3Wn2pJ8DQbc3HB8Lg29ENKqwSSoMwzQUfL6LP96pClZ4vz7XsjApMtYHINH/fxeplNAyfS9bniTmWw3z78mXI2OBK1cxH5--Hxh1AHoj2eUcIPCJ--MDVZpDlIQA0rY04Lx86jsg==
|
16XC4dR/e6ZfMDLdM5A1IWRXPbWK5XG6e3/4HXV5cKxtkL/tYSfw+JduP8XpJtH0+paiRcQ+KZvLNndy+U+K/u9GkimSKGC1u/3iIreWGH44NW5G6DpG02kqa+7F27Vt0vyK0LKG+eipwuusUi5lxlVYWV1NoxCyEgDhh0oylMBZTs5eiD82CUpXcOOi/Y6WII3XfmCa0JTn1FvMKtX8HKWUMzCJXowBhZ9MkPpjEENzBPVn5N0MbWsuwTygcABE0KyuCISpwCUrIuNFnQLhNoPAApo2MD1sAiPjDb/xVV9rwSiSqTzaovjkXadGnhDa+7gh5LRTqgpn5yuBm19ud9JVTflVomXQooHrByJEMRSWJ1BsLro7R+3eEqCsHtbgLjQ0Vpa+moO4XTvzdMOtpZvpMjY3zlHatWCEsjBXVZaTL2ptmfXjVjXscZOge6Jomw8+VjAJaAPSnR8l+O+pTu3n4oCQ270YIZhGDk+3m2zUkqb8uHDy/0pulMUSFUSI6UV7A46V061H17bnAERzHIQiFQkBLbmFWEvsPG6mMi6J7J7ynRc5/6avrj+9mKr6/REWwQijJwQTRMsSlzTaGQY6ecUX4lDxS3kzVxccqYophPR9tAwOwxjfTWyrLtQPdTPaGkh6rUcQO36BF5A=--vGTJqJldqOOCgx5I--NEnAbiMfebeJNQd9LIBAOg==
|
||||||
@@ -13,20 +13,20 @@ default: &default
|
|||||||
adapter: mysql2
|
adapter: mysql2
|
||||||
encoding: utf8mb4
|
encoding: utf8mb4
|
||||||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
||||||
username: root
|
username: OpenSMTPD
|
||||||
password: password
|
password: password
|
||||||
host: localhost
|
host: localhost
|
||||||
|
|
||||||
development:
|
development:
|
||||||
<<: *default
|
<<: *default
|
||||||
database: opensmtpd_dev
|
database: OpenSMTPD
|
||||||
|
|
||||||
# Warning: The database defined as "test" will be erased and
|
# Warning: The database defined as "test" will be erased and
|
||||||
# re-generated from your development database when you run "rake".
|
# re-generated from your development database when you run "rake".
|
||||||
# Do not set this db to the same as development or production.
|
# Do not set this db to the same as development or production.
|
||||||
test:
|
test:
|
||||||
<<: *default
|
<<: *default
|
||||||
database: opensmtpd_test
|
database: OpenSMTPD_test
|
||||||
|
|
||||||
# As with config/credentials.yml, you never want to store sensitive information,
|
# As with config/credentials.yml, you never want to store sensitive information,
|
||||||
# like your database password, in your source code. If your source code is
|
# like your database password, in your source code. If your source code is
|
||||||
@@ -50,6 +50,6 @@ test:
|
|||||||
#
|
#
|
||||||
production:
|
production:
|
||||||
<<: *default
|
<<: *default
|
||||||
database: opensmtpd
|
database: OpenSMTPD
|
||||||
username: opensmtpd
|
username: OpenSMTPD
|
||||||
password: <%= ENV["OPENSMTPD_RAILS_FRONTEND_DATABASE_PASSWORD"] %>
|
password: <%= ENV["OPENSMTPD_RAILS_FRONTEND_DATABASE_PASSWORD"] %>
|
||||||
|
|||||||
@@ -3,10 +3,8 @@ require "active_support/core_ext/integer/time"
|
|||||||
Rails.application.configure do
|
Rails.application.configure do
|
||||||
# Settings specified here will take precedence over those in config/application.rb.
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
# In the development environment your application's code is reloaded any time
|
# Make code changes take effect immediately without server restart.
|
||||||
# it changes. This slows down response time but is perfect for development
|
config.enable_reloading = true
|
||||||
# since you don't have to restart the web server when you make code changes.
|
|
||||||
config.cache_classes = false
|
|
||||||
|
|
||||||
# Do not eager load code on boot.
|
# Do not eager load code on boot.
|
||||||
config.eager_load = false
|
config.eager_load = false
|
||||||
@@ -14,48 +12,52 @@ Rails.application.configure do
|
|||||||
# Show full error reports.
|
# Show full error reports.
|
||||||
config.consider_all_requests_local = true
|
config.consider_all_requests_local = true
|
||||||
|
|
||||||
# Enable server timing
|
# Enable server timing.
|
||||||
config.server_timing = true
|
config.server_timing = true
|
||||||
|
|
||||||
# Enable/disable caching. By default caching is disabled.
|
# Enable/disable Action Controller caching. By default Action Controller caching is disabled.
|
||||||
# Run rails dev:cache to toggle caching.
|
# Run rails dev:cache to toggle Action Controller caching.
|
||||||
if Rails.root.join("tmp/caching-dev.txt").exist?
|
if Rails.root.join("tmp/caching-dev.txt").exist?
|
||||||
config.action_controller.perform_caching = true
|
config.action_controller.perform_caching = true
|
||||||
config.action_controller.enable_fragment_cache_logging = true
|
config.action_controller.enable_fragment_cache_logging = true
|
||||||
|
config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
|
||||||
config.cache_store = :memory_store
|
|
||||||
config.public_file_server.headers = {
|
|
||||||
"Cache-Control" => "public, max-age=#{2.days.to_i}"
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
config.action_controller.perform_caching = false
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
config.cache_store = :null_store
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Change to :null_store to avoid any caching.
|
||||||
|
config.cache_store = :memory_store
|
||||||
|
|
||||||
# Store uploaded files on the local file system (see config/storage.yml for options).
|
# Store uploaded files on the local file system (see config/storage.yml for options).
|
||||||
config.active_storage.service = :local
|
config.active_storage.service = :local
|
||||||
|
|
||||||
# Don't care if the mailer can't send.
|
# Don't care if the mailer can't send.
|
||||||
config.action_mailer.raise_delivery_errors = false
|
config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
|
# Make template changes take effect immediately.
|
||||||
config.action_mailer.perform_caching = false
|
config.action_mailer.perform_caching = false
|
||||||
|
|
||||||
|
# Set localhost to be used by links generated in mailer templates.
|
||||||
|
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
|
||||||
|
|
||||||
# Print deprecation notices to the Rails logger.
|
# Print deprecation notices to the Rails logger.
|
||||||
config.active_support.deprecation = :log
|
config.active_support.deprecation = :log
|
||||||
|
|
||||||
# Raise exceptions for disallowed deprecations.
|
|
||||||
config.active_support.disallowed_deprecation = :raise
|
|
||||||
|
|
||||||
# Tell Active Support which deprecation messages to disallow.
|
|
||||||
config.active_support.disallowed_deprecation_warnings = []
|
|
||||||
|
|
||||||
# Raise an error on page load if there are pending migrations.
|
# Raise an error on page load if there are pending migrations.
|
||||||
config.active_record.migration_error = :page_load
|
config.active_record.migration_error = :page_load
|
||||||
|
|
||||||
# Highlight code that triggered database queries in logs.
|
# Highlight code that triggered database queries in logs.
|
||||||
config.active_record.verbose_query_logs = true
|
config.active_record.verbose_query_logs = true
|
||||||
|
|
||||||
|
# Append comments with runtime information tags to SQL queries in logs.
|
||||||
|
config.active_record.query_log_tags_enabled = true
|
||||||
|
|
||||||
|
# Highlight code that enqueued background job in logs.
|
||||||
|
config.active_job.verbose_enqueue_logs = true
|
||||||
|
|
||||||
|
# Highlight code that triggered redirect in logs.
|
||||||
|
config.action_dispatch.verbose_redirect_logs = true
|
||||||
|
|
||||||
# Suppress logger output for asset requests.
|
# Suppress logger output for asset requests.
|
||||||
config.assets.quiet = true
|
config.assets.quiet = true
|
||||||
|
|
||||||
@@ -63,10 +65,19 @@ Rails.application.configure do
|
|||||||
# config.i18n.raise_on_missing_translations = true
|
# config.i18n.raise_on_missing_translations = true
|
||||||
|
|
||||||
# Annotate rendered view with file names.
|
# Annotate rendered view with file names.
|
||||||
# config.action_view.annotate_rendered_view_with_filenames = true
|
config.action_view.annotate_rendered_view_with_filenames = true
|
||||||
|
|
||||||
# Uncomment if you wish to allow Action Cable access from any origin.
|
# Uncomment if you wish to allow Action Cable access from any origin.
|
||||||
# config.action_cable.disable_request_forgery_protection = true
|
# config.action_cable.disable_request_forgery_protection = true
|
||||||
|
|
||||||
|
# Raise error when a before_action's only/except options reference missing actions.
|
||||||
|
config.action_controller.raise_on_missing_callback_actions = true
|
||||||
|
|
||||||
|
# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
|
||||||
|
# config.generators.apply_rubocop_autocorrect_after_generate!
|
||||||
|
|
||||||
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
|
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
|||||||
@@ -5,3 +5,4 @@ pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
|
|||||||
pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
|
pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
|
||||||
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
|
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
|
||||||
pin_all_from "app/javascript/controllers", under: "controllers"
|
pin_all_from "app/javascript/controllers", under: "controllers"
|
||||||
|
pin "@github/webauthn-json", to: "@github--webauthn-json.js" # @2.1.1
|
||||||
|
|||||||
@@ -6,7 +6,3 @@ Rails.application.config.assets.version = "1.0"
|
|||||||
# Add additional assets to the asset load path.
|
# Add additional assets to the asset load path.
|
||||||
# Rails.application.config.assets.paths << Emoji.images_path
|
# Rails.application.config.assets.paths << Emoji.images_path
|
||||||
|
|
||||||
# Precompile additional assets.
|
|
||||||
# application.js, application.css, and all non-JS/CSS in the app/assets
|
|
||||||
# folder are already added.
|
|
||||||
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
# Define an application-wide content security policy
|
# Define an application-wide content security policy.
|
||||||
# For further information see the following documentation
|
# See the Securing Rails Applications Guide for more information:
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
|
# https://guides.rubyonrails.org/security.html#content-security-policy-header
|
||||||
|
|
||||||
# Rails.application.configure do
|
# Rails.application.configure do
|
||||||
# config.content_security_policy do |policy|
|
# config.content_security_policy do |policy|
|
||||||
@@ -16,11 +16,14 @@
|
|||||||
# # policy.report_uri "/csp-violation-report-endpoint"
|
# # policy.report_uri "/csp-violation-report-endpoint"
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# # Generate session nonces for permitted importmap and inline scripts
|
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
|
||||||
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
||||||
# config.content_security_policy_nonce_directives = %w(script-src)
|
# config.content_security_policy_nonce_directives = %w(script-src style-src)
|
||||||
#
|
#
|
||||||
# # Report CSP violations to a specified URI. See:
|
# # Automatically add `nonce` to `javascript_tag`, `javascript_include_tag`, and `stylesheet_link_tag`
|
||||||
# # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
|
# # if the corresponding directives are specified in `content_security_policy_nonce_directives`.
|
||||||
|
# # config.content_security_policy_nonce_auto = true
|
||||||
|
#
|
||||||
|
# # Report violations without enforcing the policy.
|
||||||
# # config.content_security_policy_report_only = true
|
# # config.content_security_policy_report_only = true
|
||||||
# end
|
# end
|
||||||
|
|||||||
@@ -9,6 +9,10 @@
|
|||||||
# Use this hook to configure devise mailer, warden hooks and so forth.
|
# Use this hook to configure devise mailer, warden hooks and so forth.
|
||||||
# Many of these configuration options can be set straight in your model.
|
# Many of these configuration options can be set straight in your model.
|
||||||
Devise.setup do |config|
|
Devise.setup do |config|
|
||||||
|
config.warden do |manager|
|
||||||
|
manager.default_strategies(:scope => :user).unshift :two_factor_authenticatable
|
||||||
|
end
|
||||||
|
|
||||||
# The secret key used by Devise. Devise uses this key to generate
|
# The secret key used by Devise. Devise uses this key to generate
|
||||||
# random tokens. Changing this key will render invalid all existing
|
# random tokens. Changing this key will render invalid all existing
|
||||||
# confirmation, reset password and unlock tokens in the database.
|
# confirmation, reset password and unlock tokens in the database.
|
||||||
@@ -228,7 +232,7 @@ Devise.setup do |config|
|
|||||||
|
|
||||||
# When set to false, does not sign a user in automatically after their password is
|
# When set to false, does not sign a user in automatically after their password is
|
||||||
# reset. Defaults to true, so a user is signed in automatically after a reset.
|
# reset. Defaults to true, so a user is signed in automatically after a reset.
|
||||||
# config.sign_in_after_reset_password = true
|
config.sign_in_after_reset_password = false
|
||||||
|
|
||||||
# ==> Configuration for :encryptable
|
# ==> Configuration for :encryptable
|
||||||
# Allow you to use another hashing or encryption algorithm besides bcrypt (default).
|
# Allow you to use another hashing or encryption algorithm besides bcrypt (default).
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
# Configure parameters to be filtered from the log file. Use this to limit dissemination of
|
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
|
||||||
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
|
# Use this to limit dissemination of sensitive information.
|
||||||
# notations and behaviors.
|
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
|
||||||
Rails.application.config.filter_parameters += [
|
Rails.application.config.filter_parameters += [
|
||||||
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
|
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,44 +1,47 @@
|
|||||||
# Puma can serve each request in a thread from an internal thread pool.
|
|
||||||
# The `threads` method setting takes two numbers: a minimum and maximum.
|
|
||||||
# Any libraries that use thread pools should be configured to match
|
|
||||||
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
|
||||||
# and maximum; this matches the default thread size of Active Record.
|
|
||||||
#
|
|
||||||
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
|
|
||||||
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
|
|
||||||
threads min_threads_count, max_threads_count
|
|
||||||
|
|
||||||
# Specifies the `worker_timeout` threshold that Puma will use to wait before
|
|
||||||
# terminating a worker in development environments.
|
#bind 'tcp://0.0.0.0:3002'
|
||||||
|
|
||||||
|
# This configuration file will be evaluated by Puma. The top-level methods that
|
||||||
|
# are invoked here are part of Puma's configuration DSL. For more information
|
||||||
|
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
|
||||||
#
|
#
|
||||||
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
|
# Puma starts a configurable number of processes (workers) and each process
|
||||||
|
# serves each request in a thread from an internal thread pool.
|
||||||
|
#
|
||||||
|
# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You
|
||||||
|
# should only set this value when you want to run 2 or more workers. The
|
||||||
|
# default is already 1. You can set it to `auto` to automatically start a worker
|
||||||
|
# for each available processor.
|
||||||
|
#
|
||||||
|
# The ideal number of threads per worker depends both on how much time the
|
||||||
|
# application spends waiting for IO operations and on how much you wish to
|
||||||
|
# prioritize throughput over latency.
|
||||||
|
#
|
||||||
|
# As a rule of thumb, increasing the number of threads will increase how much
|
||||||
|
# traffic a given process can handle (throughput), but due to CRuby's
|
||||||
|
# Global VM Lock (GVL) it has diminishing returns and will degrade the
|
||||||
|
# response time (latency) of the application.
|
||||||
|
#
|
||||||
|
# The default is set to 3 threads as it's deemed a decent compromise between
|
||||||
|
# throughput and latency for the average Rails application.
|
||||||
|
#
|
||||||
|
# Any libraries that use a connection pool or another resource pool should
|
||||||
|
# be configured to provide at least as many connections as the number of
|
||||||
|
# threads. This includes Active Record's `pool` parameter in `database.yml`.
|
||||||
|
threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
|
||||||
|
threads threads_count, threads_count
|
||||||
|
|
||||||
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
||||||
#
|
port ENV.fetch("PORT", 3000)
|
||||||
port ENV.fetch("PORT") { 3001 }
|
|
||||||
|
|
||||||
# Specifies the `environment` that Puma will run in.
|
|
||||||
#
|
|
||||||
environment ENV.fetch("RAILS_ENV") { "development" }
|
|
||||||
|
|
||||||
# Specifies the `pidfile` that Puma will use.
|
|
||||||
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
|
|
||||||
|
|
||||||
# Specifies the number of `workers` to boot in clustered mode.
|
|
||||||
# Workers are forked web server processes. If using threads and workers together
|
|
||||||
# the concurrency of the application would be max `threads` * `workers`.
|
|
||||||
# Workers do not work on JRuby or Windows (both of which do not support
|
|
||||||
# processes).
|
|
||||||
#
|
|
||||||
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
|
||||||
|
|
||||||
# Use the `preload_app!` method when specifying a `workers` number.
|
|
||||||
# This directive tells Puma to first boot the application and load code
|
|
||||||
# before forking the application. This takes advantage of Copy On Write
|
|
||||||
# process behavior so workers use less memory.
|
|
||||||
#
|
|
||||||
# preload_app!
|
|
||||||
|
|
||||||
# Allow puma to be restarted by `bin/rails restart` command.
|
# Allow puma to be restarted by `bin/rails restart` command.
|
||||||
plugin :tmp_restart
|
plugin :tmp_restart
|
||||||
bind 'tcp://0.0.0.0:3002'
|
|
||||||
|
# Run the Solid Queue supervisor inside of Puma for single-server deployments.
|
||||||
|
plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"]
|
||||||
|
|
||||||
|
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
|
||||||
|
# In other environments, only set the PID file if requested.
|
||||||
|
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ Rails.application.routes.draw do
|
|||||||
put 'users' => 'devise/registrations#update', :as => 'user_registration'
|
put 'users' => 'devise/registrations#update', :as => 'user_registration'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
resources :mfas, only: [:new, :create]
|
||||||
|
|
||||||
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
||||||
|
|
||||||
# Defines the root path route ("/")
|
# Defines the root path route ("/")
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
class AddDomainIdToVirtuals < ActiveRecord::Migration[7.0]
|
|
||||||
def change
|
|
||||||
add_column :virtuals, :domain_id, :integer
|
|
||||||
add_column :credentials, :domain_id, :integer
|
|
||||||
add_index :virtuals, :domain_id
|
|
||||||
add_index :credentials, :domain_id
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
class AddDeviseTwoFactorToUsers < ActiveRecord::Migration[7.1]
|
||||||
|
def change
|
||||||
|
add_column :users, :otp_secret, :string
|
||||||
|
add_column :users, :consumed_timestep, :integer
|
||||||
|
add_column :users, :otp_required_for_login, :boolean
|
||||||
|
end
|
||||||
|
end
|
||||||
8
db/migrate/20260427123300_create_domains_admins.rb
Normal file
8
db/migrate/20260427123300_create_domains_admins.rb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
class CreateDomainsAdmins < ActiveRecord::Migration[8.1]
|
||||||
|
def change
|
||||||
|
create_table :domains_admins, id: false do |t|
|
||||||
|
t.belongs_to :users
|
||||||
|
t.belongs_to :domains
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class AddDomainRedToCredentials < ActiveRecord::Migration[8.1]
|
||||||
|
def change
|
||||||
|
add_reference :credentials, :domain, null: false, foreign_key: true
|
||||||
|
end
|
||||||
|
end
|
||||||
5
db/migrate/20260430152237_add_domain_red_to_virtuals.rb
Normal file
5
db/migrate/20260430152237_add_domain_red_to_virtuals.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
class AddDomainRedToVirtuals < ActiveRecord::Migration[8.1]
|
||||||
|
def change
|
||||||
|
add_reference :virtuals, :domain, null: false, foreign_key: true
|
||||||
|
end
|
||||||
|
end
|
||||||
55
db/schema.rb
generated
55
db/schema.rb
generated
@@ -10,50 +10,63 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.0].define(version: 2023_06_21_060115) do
|
ActiveRecord::Schema[8.1].define(version: 2026_04_30_152237) do
|
||||||
create_table "credentials", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
|
create_table "credentials", charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.bigint "domain_id", null: false
|
||||||
t.string "email"
|
t.string "email"
|
||||||
t.string "password"
|
t.string "password"
|
||||||
t.datetime "created_at", null: false
|
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.integer "domain_id"
|
|
||||||
t.index ["domain_id"], name: "index_credentials_on_domain_id"
|
t.index ["domain_id"], name: "index_credentials_on_domain_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "domains", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
|
create_table "domains", charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
||||||
t.string "domain"
|
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
|
t.string "domain"
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "users", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
|
create_table "domains_admins", id: false, charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
||||||
|
t.bigint "domains_id"
|
||||||
|
t.bigint "users_id"
|
||||||
|
t.index ["domains_id"], name: "index_domains_admins_on_domains_id"
|
||||||
|
t.index ["users_id"], name: "index_domains_admins_on_users_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "users", charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
||||||
|
t.integer "consumed_timestep"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "current_sign_in_at"
|
||||||
|
t.string "current_sign_in_ip"
|
||||||
t.string "email", default: "", null: false
|
t.string "email", default: "", null: false
|
||||||
t.string "encrypted_password", default: "", null: false
|
t.string "encrypted_password", default: "", null: false
|
||||||
t.string "reset_password_token"
|
|
||||||
t.datetime "reset_password_sent_at"
|
|
||||||
t.datetime "remember_created_at"
|
|
||||||
t.integer "sign_in_count", default: 0, null: false
|
|
||||||
t.datetime "current_sign_in_at"
|
|
||||||
t.datetime "last_sign_in_at"
|
|
||||||
t.string "current_sign_in_ip"
|
|
||||||
t.string "last_sign_in_ip"
|
|
||||||
t.integer "failed_attempts", default: 0, null: false
|
t.integer "failed_attempts", default: 0, null: false
|
||||||
t.string "unlock_token"
|
t.datetime "last_sign_in_at"
|
||||||
|
t.string "last_sign_in_ip"
|
||||||
t.datetime "locked_at"
|
t.datetime "locked_at"
|
||||||
t.datetime "created_at", null: false
|
t.boolean "otp_required_for_login"
|
||||||
|
t.string "otp_secret"
|
||||||
|
t.datetime "remember_created_at"
|
||||||
|
t.datetime "reset_password_sent_at"
|
||||||
|
t.string "reset_password_token"
|
||||||
|
t.integer "role", default: 1000, null: false
|
||||||
|
t.integer "sign_in_count", default: 0, null: false
|
||||||
|
t.string "unlock_token"
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.index ["email"], name: "index_users_on_email", unique: true
|
t.index ["email"], name: "index_users_on_email", unique: true
|
||||||
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||||
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
|
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "virtuals", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
|
create_table "virtuals", charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
||||||
t.string "email"
|
|
||||||
t.string "destination"
|
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
|
t.string "destination"
|
||||||
|
t.bigint "domain_id", null: false
|
||||||
|
t.string "email"
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.integer "domain_id"
|
|
||||||
t.index ["domain_id"], name: "index_virtuals_on_domain_id"
|
t.index ["domain_id"], name: "index_virtuals_on_domain_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_foreign_key "credentials", "domains"
|
||||||
|
add_foreign_key "virtuals", "domains"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class CredentialsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
|
|
||||||
setup do
|
setup do
|
||||||
@credential = credentials(:one)
|
@credential = credentials(:one)
|
||||||
@domain = domains(:one)
|
@domain = domains(:domainone)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should not get new" do
|
test "should not get new" do
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ require "test_helper"
|
|||||||
class DomainsControllerTest < ActionDispatch::IntegrationTest
|
class DomainsControllerTest < ActionDispatch::IntegrationTest
|
||||||
include Devise::Test::IntegrationHelpers
|
include Devise::Test::IntegrationHelpers
|
||||||
setup do
|
setup do
|
||||||
@domain = domains(:one)
|
@domain = domains(:domainone)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "not should get index because user not logged in" do
|
test "not should get index because user not logged in" do
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class VirtualsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
|
|
||||||
setup do
|
setup do
|
||||||
@virtual = virtuals(:one)
|
@virtual = virtuals(:one)
|
||||||
@domain = domains(:one)
|
@domain = domains(:domainone)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should get not get new because we are not logged in" do
|
test "should get not get new because we are not logged in" do
|
||||||
|
|||||||
4
test/fixtures/credentials.yml
vendored
4
test/fixtures/credentials.yml
vendored
@@ -3,9 +3,9 @@
|
|||||||
one:
|
one:
|
||||||
email: bob@example.net
|
email: bob@example.net
|
||||||
password: MyString
|
password: MyString
|
||||||
domain: one
|
domain: domainone
|
||||||
|
|
||||||
two:
|
two:
|
||||||
email: alice@example.org
|
email: alice@example.org
|
||||||
password: MyString
|
password: MyString
|
||||||
domain: two
|
domain: domaintwo
|
||||||
|
|||||||
4
test/fixtures/domains.yml
vendored
4
test/fixtures/domains.yml
vendored
@@ -1,7 +1,7 @@
|
|||||||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
one:
|
domainone:
|
||||||
domain: example.net
|
domain: example.net
|
||||||
|
|
||||||
two:
|
domaintwo:
|
||||||
domain: example.org
|
domain: example.org
|
||||||
|
|||||||
@@ -19,7 +19,12 @@ class CredentialTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "domain added to name" do
|
test "domain added to name" do
|
||||||
@c = Credential.new(email: "jez@#{domains(:one).domain}", password: "1234567&ab", domain_id: domains(:one).id)
|
@c = Credential.new(email: "jez@#{domains(:domainone).domain}", password: "1234567&ab", domain_id: domains(:domainone).id)
|
||||||
assert @c.save
|
assert @c.save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "domain_id not the same as domain" do
|
||||||
|
@c = Credential.new(email: "steve@#{domains(:domainone).domain}", password: "1234567&ab", domain_id: domains(:domainone).id)
|
||||||
|
assert_not @c.save
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -22,4 +22,16 @@ class DomainTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
assert_equal(@d.virtuals.count,2)
|
assert_equal(@d.virtuals.count,2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "valid domain names only" do
|
||||||
|
@d = Domain.new(domain: "Spaces Spaces.co.uk")
|
||||||
|
assert_not @d.save
|
||||||
|
|
||||||
|
@d.domain = "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.com"
|
||||||
|
assert_not @d.save
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class VirtualTest < ActiveSupport::TestCase
|
|||||||
@v = Virtual.new
|
@v = Virtual.new
|
||||||
@v.email = "abuse@example.net"
|
@v.email = "abuse@example.net"
|
||||||
@v.destination = "valid@email.com"
|
@v.destination = "valid@email.com"
|
||||||
@v.domain_id = domains(:one).id + 1234
|
@v.domain_id = domains(:domainone).id + 1234
|
||||||
assert !@v.save
|
assert !@v.save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
2
vendor/javascript/@github--webauthn-json.js
vendored
Normal file
2
vendor/javascript/@github--webauthn-json.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
function base64urlToBuffer(e){const r="==".slice(0,(4-e.length%4)%4);const t=e.replace(/-/g,"+").replace(/_/g,"/")+r;const n=atob(t);const i=new ArrayBuffer(n.length);const o=new Uint8Array(i);for(let e=0;e<n.length;e++)o[e]=n.charCodeAt(e);return i}function bufferToBase64url(e){const r=new Uint8Array(e);let t="";for(const e of r)t+=String.fromCharCode(e);const n=btoa(t);const i=n.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"");return i}var e="copy";var r="convert";function convert(t,n,i){if(n===e)return i;if(n===r)return t(i);if(n instanceof Array)return i.map((e=>convert(t,n[0],e)));if(n instanceof Object){const e={};for(const[r,o]of Object.entries(n)){if(o.derive){const e=o.derive(i);void 0!==e&&(i[r]=e)}if(r in i)null!=i[r]?e[r]=convert(t,o.schema,i[r]):e[r]=null;else if(o.required)throw new Error(`Missing key: ${r}`)}return e}}function derived(e,r){return{required:true,schema:e,derive:r}}function required(e){return{required:true,schema:e}}function optional(e){return{required:false,schema:e}}var t={type:required(e),id:required(r),transports:optional(e)};var n={appid:optional(e),appidExclude:optional(e),credProps:optional(e)};var i={appid:optional(e),appidExclude:optional(e),credProps:optional(e)};var o={publicKey:required({rp:required(e),user:required({id:required(r),name:required(e),displayName:required(e)}),challenge:required(r),pubKeyCredParams:required(e),timeout:optional(e),excludeCredentials:optional([t]),authenticatorSelection:optional(e),attestation:optional(e),extensions:optional(n)}),signal:optional(e)};var a={type:required(e),id:required(e),rawId:required(r),authenticatorAttachment:optional(e),response:required({clientDataJSON:required(r),attestationObject:required(r),transports:derived(e,(e=>{var r;return(null==(r=e.getTransports)?void 0:r.call(e))||[]}))}),clientExtensionResults:derived(i,(e=>e.getClientExtensionResults()))};var u={mediation:optional(e),publicKey:required({challenge:required(r),timeout:optional(e),rpId:optional(e),allowCredentials:optional([t]),userVerification:optional(e),extensions:optional(n)}),signal:optional(e)};var s={type:required(e),id:required(e),rawId:required(r),authenticatorAttachment:optional(e),response:required({clientDataJSON:required(r),authenticatorData:required(r),signature:required(r),userHandle:required(r)}),clientExtensionResults:derived(i,(e=>e.getClientExtensionResults()))};var c={credentialCreationOptions:o,publicKeyCredentialWithAttestation:a,credentialRequestOptions:u,publicKeyCredentialWithAssertion:s};function createRequestFromJSON(e){return convert(base64urlToBuffer,o,e)}function createResponseToJSON(e){return convert(bufferToBase64url,a,e)}async function create(e){const r=await navigator.credentials.create(createRequestFromJSON(e));return createResponseToJSON(r)}function getRequestFromJSON(e){return convert(base64urlToBuffer,u,e)}function getResponseToJSON(e){return convert(bufferToBase64url,s,e)}async function get(e){const r=await navigator.credentials.get(getRequestFromJSON(e));return getResponseToJSON(r)}function supported(){return!!(navigator.credentials&&navigator.credentials.create&&navigator.credentials.get&&window.PublicKeyCredential)}export{create,get,c as schema,supported};
|
||||||
|
|
||||||
Reference in New Issue
Block a user