authtown 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +20 -14
- data/authtown.gemspec +1 -1
- data/lib/authtown/version.rb +1 -1
- data/lib/authtown.rb +0 -2
- metadata +3 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ede138d3793ef5ced8186a414504c563f4eeebfb5b9db5a70a6190acaab2f6a
|
4
|
+
data.tar.gz: 15886fbb260d0d227c963c699836ed33efe82f197386eec3d5d74c05eb2c42ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c295e46ee116cd0d539c95a98fcce53ca3e2eba4910b7f6ff67b0c4613670b6aee9b7d3f053260884ebd9be7941b647fd853a38f227125c197e5de61ab295a9
|
7
|
+
data.tar.gz: a89dd959c571fc6e089c7fec8431634c5896cf03ce5a52a89ea4873f1cb9e25d6936c6717eac69cab9a977802405146783a2e4045d05c8f37567e7762f155a74
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [0.6.0] - 2025-01-12
|
11
|
+
|
12
|
+
- Support for production Bridgetown 2.0 release.
|
13
|
+
|
10
14
|
## [0.5.0] - 2025-01-12
|
11
15
|
|
12
16
|
- Fix incorrect Rodauth method override
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Authtown: Rodauth integration for Bridgetown
|
2
2
|
|
3
|
-
A Bridgetown plugin which provides authentication and account management via database access and SSR routes, powered by [Rodauth](https://rodauth.jeremyevans.net).
|
3
|
+
A Bridgetown plugin which provides authentication and account management via database access and SSR routes, powered by [Rodauth](https://rodauth.jeremyevans.net).
|
4
4
|
|
5
5
|
**WIP — public 1.0 release coming soon once Bridgetown 2.0 ships!**
|
6
6
|
|
@@ -14,7 +14,12 @@ Run this command to add this plugin to your site's Gemfile:
|
|
14
14
|
bundle add authtown
|
15
15
|
```
|
16
16
|
|
17
|
-
|
17
|
+
You'll also need the lifeform gem to build the login form:
|
18
|
+
```shell
|
19
|
+
bundle add lifeform
|
20
|
+
```
|
21
|
+
|
22
|
+
Then set up a mail initializer file (in `config/mail.rb`):
|
18
23
|
|
19
24
|
```ruby
|
20
25
|
Bridgetown.initializer :mail do |password:|
|
@@ -35,9 +40,7 @@ And call that from your configuration in `config/initializers.rb`:
|
|
35
40
|
|
36
41
|
```ruby
|
37
42
|
only :server do
|
38
|
-
init :mail
|
39
|
-
password ENV.fetch("SERVICE_API_KEY", nil) # can come from .env file or hosting environment
|
40
|
-
end
|
43
|
+
init :mail, password: ENV.fetch("SERVICE_API_KEY", nil) # can come from .env file or hosting environment
|
41
44
|
end
|
42
45
|
```
|
43
46
|
|
@@ -75,7 +78,7 @@ You will need to generate a secret key for Roda's session handling. Run `bin/bri
|
|
75
78
|
RODA_SECRET_KEY=1f8dbd0da3a4...
|
76
79
|
```
|
77
80
|
|
78
|
-
You will also need to generate a Sequel migration for your user accounts. Here is an example, you can tweak as necessary. Run `bin/bridgetown db
|
81
|
+
You will also need to generate a Sequel migration for your user accounts. Here is an example, you can tweak as necessary. Run `bin/bridgetown db:migrations:new filename=create_users`, then edit the file:
|
79
82
|
|
80
83
|
```ruby
|
81
84
|
Sequel.migration do
|
@@ -85,6 +88,7 @@ Sequel.migration do
|
|
85
88
|
create_table(:users) do
|
86
89
|
primary_key :id, type: :Bignum
|
87
90
|
citext :email, null: false
|
91
|
+
# Not available on SQLite
|
88
92
|
constraint :valid_email, email: /^[^,;@ \r\n]+@[^,@; \r\n]+\.[^,@; \r\n]+$/
|
89
93
|
String :first_name
|
90
94
|
String :password_hash, null: false
|
@@ -132,6 +136,8 @@ Now, let's set up our forms and auth pages. We'll begin by creating an Account f
|
|
132
136
|
```ruby
|
133
137
|
# ./models/forms/account.rb
|
134
138
|
|
139
|
+
require "lifeform" # Needed because Zeitwerk will try loading Forms::Lifeform and then fail.
|
140
|
+
|
135
141
|
module Forms
|
136
142
|
class Account < Lifeform::Form
|
137
143
|
fields do
|
@@ -141,7 +147,7 @@ module Forms
|
|
141
147
|
required: true,
|
142
148
|
autocomplete: "username",
|
143
149
|
autofocus: true
|
144
|
-
field :
|
150
|
+
field :first_name,
|
145
151
|
label: "Your Name",
|
146
152
|
autocomplete: "name",
|
147
153
|
required: true
|
@@ -163,7 +169,7 @@ Next, let's create the pages for logging in or creating an account.
|
|
163
169
|
```erb
|
164
170
|
---<%
|
165
171
|
render_with do
|
166
|
-
layout :page
|
172
|
+
layout :page
|
167
173
|
title "Sign In"
|
168
174
|
end
|
169
175
|
%>---
|
@@ -207,7 +213,7 @@ end
|
|
207
213
|
```erb
|
208
214
|
---<%
|
209
215
|
render_with do
|
210
|
-
layout :page
|
216
|
+
layout :page
|
211
217
|
title "Sign Up"
|
212
218
|
end
|
213
219
|
%>---
|
@@ -255,7 +261,7 @@ end
|
|
255
261
|
```erb
|
256
262
|
<form-errors>
|
257
263
|
<p aria-live="assertive">
|
258
|
-
<% if flash[:error] %>
|
264
|
+
<% if flash[:error] || rodauth.field_error(rodauth.login_param) || rodauth.field_error(rodauth.password_param) %>
|
259
265
|
<%= flash[:error] %>:
|
260
266
|
<br/>
|
261
267
|
<small>
|
@@ -280,13 +286,13 @@ We'll still need ones for password reset, but let's hold off for the moment. We'
|
|
280
286
|
rodauth.require_authentication # always include this before logged-in only routes
|
281
287
|
|
282
288
|
render_with do
|
283
|
-
layout :page
|
289
|
+
layout :page
|
284
290
|
title "Your Account"
|
285
291
|
end
|
286
292
|
%>---
|
287
293
|
|
288
294
|
<%= markdownify do %>
|
289
|
-
|
295
|
+
|
290
296
|
Welcome back, **<%= current_user.first_name %>**.
|
291
297
|
|
292
298
|
(other content here)
|
@@ -311,7 +317,7 @@ As a final step, we'll need to handle password reset. Add the following pages:
|
|
311
317
|
```erb
|
312
318
|
---<%
|
313
319
|
render_with do
|
314
|
-
layout :page
|
320
|
+
layout :page
|
315
321
|
title "Reset Your Password"
|
316
322
|
end
|
317
323
|
%>---
|
@@ -339,7 +345,7 @@ end
|
|
339
345
|
```erb
|
340
346
|
---<%
|
341
347
|
render_with do
|
342
|
-
layout :page
|
348
|
+
layout :page
|
343
349
|
title "Save New Password"
|
344
350
|
end
|
345
351
|
%>---
|
data/authtown.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
|
18
18
|
spec.required_ruby_version = ">= 3.1"
|
19
19
|
|
20
|
-
spec.add_dependency "bridgetown", ">=
|
20
|
+
spec.add_dependency "bridgetown", ">= 2.0"
|
21
21
|
spec.add_dependency "rodauth", ">= 2.30"
|
22
22
|
spec.add_dependency "bcrypt", ">= 3.1"
|
23
23
|
spec.add_dependency "mail", ">= 2.8"
|
data/lib/authtown/version.rb
CHANGED
data/lib/authtown.rb
CHANGED
@@ -5,7 +5,6 @@ require "mail"
|
|
5
5
|
require "authtown/builder"
|
6
6
|
require "authtown/view_mixin"
|
7
7
|
|
8
|
-
# rubocop:disable Layout/LineLength
|
9
8
|
### Simple migration strategy:
|
10
9
|
#
|
11
10
|
# Sequel.migration do
|
@@ -36,7 +35,6 @@ require "authtown/view_mixin"
|
|
36
35
|
# end
|
37
36
|
# end
|
38
37
|
# end
|
39
|
-
# rubocop:enable Layout/LineLength
|
40
38
|
|
41
39
|
Thread.attr_accessor :authtown_state
|
42
40
|
class Authtown::Current
|
metadata
CHANGED
@@ -1,23 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authtown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bridgetown Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bridgetown
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 1.3.0
|
20
|
-
- - "<"
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: '2.0'
|
23
20
|
type: :runtime
|
@@ -25,9 +22,6 @@ dependencies:
|
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 1.3.0
|
30
|
-
- - "<"
|
31
25
|
- !ruby/object:Gem::Version
|
32
26
|
version: '2.0'
|
33
27
|
- !ruby/object:Gem::Dependency
|
@@ -156,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
150
|
- !ruby/object:Gem::Version
|
157
151
|
version: '0'
|
158
152
|
requirements: []
|
159
|
-
rubygems_version: 3.5.
|
153
|
+
rubygems_version: 3.5.16
|
160
154
|
signing_key:
|
161
155
|
specification_version: 4
|
162
156
|
summary: Rodauth integration for Bridgetown
|