Add rodauth
This commit is contained in:
1 parent
747dd5c78f
commit
7a4805f749
6 files changed
+49
-13
No files matched your search
@@ -24,3 +24,7 @@ gem "mail"
|
|||||||
|
|
||||||
# Markdown
|
# Markdown
|
||||||
gem "commonmarker"
|
gem "commonmarker"
|
||||||
|
|
||||||
|
# Authentication
|
||||||
|
gem "rodauth"
|
||||||
|
gem "bcrypt"
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
|
bcrypt (3.1.22)
|
||||||
bigdecimal (4.1.3)
|
bigdecimal (4.1.3)
|
||||||
commonmarker (2.10.1-x86_64-linux)
|
commonmarker (2.10.1-x86_64-linux)
|
||||||
date (3.6.0)
|
date (3.6.0)
|
||||||
@@ -53,6 +54,9 @@ GEM
|
|||||||
io-console (~> 0.5)
|
io-console (~> 0.5)
|
||||||
roda (3.109.0)
|
roda (3.109.0)
|
||||||
rack
|
rack
|
||||||
|
rodauth (2.49.0)
|
||||||
|
roda (>= 2.6.0)
|
||||||
|
sequel (>= 4)
|
||||||
sequel (5.110.0)
|
sequel (5.110.0)
|
||||||
bigdecimal
|
bigdecimal
|
||||||
sqlite3 (2.10.2-x86_64-linux-gnu)
|
sqlite3 (2.10.2-x86_64-linux-gnu)
|
||||||
@@ -64,6 +68,7 @@ PLATFORMS
|
|||||||
x86_64-linux
|
x86_64-linux
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
bcrypt (~> 3.1)
|
||||||
commonmarker
|
commonmarker
|
||||||
dotenv
|
dotenv
|
||||||
erubi
|
erubi
|
||||||
@@ -72,11 +77,13 @@ DEPENDENCIES
|
|||||||
puma
|
puma
|
||||||
rackup
|
rackup
|
||||||
roda
|
roda
|
||||||
|
rodauth (~> 2.49)
|
||||||
sequel
|
sequel
|
||||||
sqlite3
|
sqlite3
|
||||||
tilt
|
tilt
|
||||||
|
|
||||||
CHECKSUMS
|
CHECKSUMS
|
||||||
|
bcrypt (3.1.22) sha256=1f0072e88c2d705d94aff7f2c5cb02eb3f1ec4b8368671e19112527489f29032
|
||||||
bigdecimal (4.1.3) sha256=61ebe1e5e559bdc3cc6f2c0ee7f427321fc838f59611c294356eb04d6e21cf66
|
bigdecimal (4.1.3) sha256=61ebe1e5e559bdc3cc6f2c0ee7f427321fc838f59611c294356eb04d6e21cf66
|
||||||
commonmarker (2.10.1-x86_64-linux) sha256=4b2c4b9084baca131146c92dde02bcb40ef3d2768a6772648c1970bb51842734
|
commonmarker (2.10.1-x86_64-linux) sha256=4b2c4b9084baca131146c92dde02bcb40ef3d2768a6772648c1970bb51842734
|
||||||
date (3.6.0) sha256=18ac945c4e24ebd93534f8eab8c2fd8c5604b3e977105b3798d62a1e8d27b580
|
date (3.6.0) sha256=18ac945c4e24ebd93534f8eab8c2fd8c5604b3e977105b3798d62a1e8d27b580
|
||||||
@@ -103,6 +110,7 @@ CHECKSUMS
|
|||||||
rdoc (8.1.0) sha256=befc37880a5cfd36dcb176c748b5fd5ee39dd3536a75e81824e4972ce230f60a
|
rdoc (8.1.0) sha256=befc37880a5cfd36dcb176c748b5fd5ee39dd3536a75e81824e4972ce230f60a
|
||||||
reline (0.7.0) sha256=5b012d8e55dbf9d450f12bde2cf7d15ff546ae80b3f8f3b30e570d431815583d
|
reline (0.7.0) sha256=5b012d8e55dbf9d450f12bde2cf7d15ff546ae80b3f8f3b30e570d431815583d
|
||||||
roda (3.109.0) sha256=470f60355043a7732edb08ece2d12eb2e6912866ac87106c92ded5f6f8a5a8dc
|
roda (3.109.0) sha256=470f60355043a7732edb08ece2d12eb2e6912866ac87106c92ded5f6f8a5a8dc
|
||||||
|
rodauth (2.49.0) sha256=c4450072ca7b01ba59e51f0c41fbbd0884a2356ccccf141519b45857d646a255
|
||||||
sequel (5.110.0) sha256=c316335b352adb4109bb02ade237b1a6dbd493493def34542ce05893f62138ae
|
sequel (5.110.0) sha256=c316335b352adb4109bb02ade237b1a6dbd493493def34542ce05893f62138ae
|
||||||
sqlite3 (2.10.2-x86_64-linux-gnu) sha256=ca92731ab464df9cae503fa1a439a549e2724f6953c8c05a7769b59366e38f15
|
sqlite3 (2.10.2-x86_64-linux-gnu) sha256=ca92731ab464df9cae503fa1a439a549e2724f6953c8c05a7769b59366e38f15
|
||||||
tilt (2.9.0) sha256=da5735d0280bba96e9a91041bb14aee435ccad5c17b0fa519249ae543d9aa3a5
|
tilt (2.9.0) sha256=da5735d0280bba96e9a91041bb14aee435ccad5c17b0fa519249ae543d9aa3a5
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
Sequel.migration do
|
||||||
|
up do
|
||||||
|
create_table(:accounts) do
|
||||||
|
primary_key :id, type: :Bignum
|
||||||
|
String :email, null: false
|
||||||
|
|
||||||
|
index :email, unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table(:account_password_hashes) do
|
||||||
|
foreign_key :id, :accounts, primary_key: true, type: :Bignum
|
||||||
|
String :password_hash, null: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
down do
|
||||||
|
drop_table(:account_password_hashes, :accounts)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
Sequel.migration do
|
|
||||||
up do
|
|
||||||
create_table(:test_records) do
|
|
||||||
primary_key :id
|
|
||||||
String :message, null: false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
down do
|
|
||||||
drop_table(:test_records)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
require "roda"
|
require "roda"
|
||||||
|
require "rodauth"
|
||||||
|
|
||||||
require_relative "lib/database"
|
require_relative "lib/database"
|
||||||
require_relative "config/mail"
|
require_relative "config/mail"
|
||||||
@@ -15,9 +16,25 @@ class Netig < Roda
|
|||||||
plugin :hash_branches
|
plugin :hash_branches
|
||||||
plugin :flash
|
plugin :flash
|
||||||
|
|
||||||
|
plugin :rodauth do
|
||||||
|
db DB
|
||||||
|
|
||||||
|
enable :login, :logout
|
||||||
|
|
||||||
|
login_label "Adresse électronique"
|
||||||
|
password_label "Mot de passe"
|
||||||
|
login_button "Se connecter"
|
||||||
|
|
||||||
|
already_logged_in do
|
||||||
|
request.redirect("/")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
require_relative "routes/contact"
|
require_relative "routes/contact"
|
||||||
|
|
||||||
route do |r|
|
route do |r|
|
||||||
|
r.rodauth
|
||||||
|
|
||||||
r.public
|
r.public
|
||||||
check_csrf!
|
check_csrf!
|
||||||
r.hash_branches
|
r.hash_branches
|
||||||
|
|||||||
+1
-1
@@ -40,7 +40,7 @@
|
|||||||
<a href="https://webmail.netig.net" target="_blank" rel="noopener noreferrer">NETmail ↗</a>
|
<a href="https://webmail.netig.net" target="_blank" rel="noopener noreferrer">NETmail ↗</a>
|
||||||
<a href="https://cloud.netig.net" target="_blank" rel="noopener noreferrer">NETcloud ↗</a>
|
<a href="https://cloud.netig.net" target="_blank" rel="noopener noreferrer">NETcloud ↗</a>
|
||||||
<a href="https://git.netig.net" target="_blank" rel="noopener noreferrer">NETgit ↗</a>
|
<a href="https://git.netig.net" target="_blank" rel="noopener noreferrer">NETgit ↗</a>
|
||||||
<a class="topbar__account" href="/temporary_page">Mon espace ➜</a>
|
<a class="topbar__account" href="/login">Mon espace ➜</a>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user