Skip to content

Commit 21bf2ac

Browse files
authored
Merge pull request #408 from rails/flavorjones-rails8beta1-auth-templates
Make copies of the auth templates for Rails 8 beta1
2 parents 4fe7139 + 9dee33a commit 21bf2ac

File tree

5 files changed

+85
-6
lines changed

5 files changed

+85
-6
lines changed

.github/workflows/upstream.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ on:
1010
types: [opened, synchronize]
1111
branches:
1212
- '*'
13-
paths:
14-
- .github/workflows/upstream.yml # this file
1513

1614
jobs:
1715
tests:
@@ -37,14 +35,15 @@ jobs:
3735
run: bin/test
3836

3937
user-journey:
40-
name: "user-journey (rails main)"
38+
name: "user-journey (rails ${{ matrix.ref }})"
4139
runs-on: ${{matrix.plat}}-latest
4240
strategy:
4341
fail-fast: false
4442
matrix:
45-
plat: ["ubuntu", "windows", "macos"]
43+
plat: ["ubuntu"]
44+
ref: ["7-2-stable", "v8.0.0.beta1", "main"]
4645
env:
47-
RAILSOPTS: --git=https://github.com/rails/rails --branch main
46+
RAILSOPTS: --git=https://github.com/rails/rails --ref=${{ matrix.ref }}
4847
steps:
4948
- uses: actions/checkout@v4
5049
- uses: ruby/setup-ruby@v1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<div class="mx-auto md:w-2/3 w-full">
2+
<%% if alert = flash[:alert] %>
3+
<p class="py-2 px-3 bg-red-50 mb-5 text-red-500 font-medium rounded-lg inline-block" id="alert"><%%= alert %></p>
4+
<%% end %>
5+
6+
<h1 class="font-bold text-4xl">Update your password</h1>
7+
8+
<%%= form_with url: password_path(params[:token]), method: :put, class: "contents" do |form| %>
9+
<div class="my-5">
10+
<%%= form.password_field :password, required: true, autocomplete: "new-password", placeholder: "Enter new password", maxlength: 72, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
11+
</div>
12+
13+
<div class="my-5">
14+
<%%= form.password_field :password_confirmation, required: true, autocomplete: "new-password", placeholder: "Repeat new password", maxlength: 72, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
15+
</div>
16+
17+
<div class="inline">
18+
<%%= form.submit "Save", class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
19+
</div>
20+
<%% end %>
21+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<div class="mx-auto md:w-2/3 w-full">
2+
<%% if alert = flash[:alert] %>
3+
<p class="py-2 px-3 bg-red-50 mb-5 text-red-500 font-medium rounded-lg inline-block" id="alert"><%%= alert %></p>
4+
<%% end %>
5+
6+
<h1 class="font-bold text-4xl">Forgot your password?</h1>
7+
8+
<%%= form_with url: passwords_path, class: "contents" do |form| %>
9+
<div class="my-5">
10+
<%%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address], class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
11+
</div>
12+
13+
<div class="inline">
14+
<%%= form.submit "Email reset instructions", class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
15+
</div>
16+
<%% end %>
17+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<div class="mx-auto md:w-2/3 w-full">
2+
<%% if alert = flash[:alert] %>
3+
<p class="py-2 px-3 bg-red-50 mb-5 text-red-500 font-medium rounded-lg inline-block" id="alert"><%%= alert %></p>
4+
<%% end %>
5+
6+
<%% if notice = flash[:notice] %>
7+
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%%= notice %></p>
8+
<%% end %>
9+
10+
<h1 class="font-bold text-4xl">Sign in</h1>
11+
12+
<%%= form_with url: session_url, class: "contents" do |form| %>
13+
<div class="my-5">
14+
<%%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address], class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
15+
</div>
16+
17+
<div class="my-5">
18+
<%%= form.password_field :password, required: true, autocomplete: "current-password", placeholder: "Enter your password", maxlength: 72, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
19+
</div>
20+
21+
<div class="col-span-6 sm:flex sm:items-center sm:gap-4">
22+
<div class="inline">
23+
<%%= form.submit "Sign in", class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
24+
</div>
25+
26+
<div class="mt-4 text-sm text-gray-500 sm:mt-0">
27+
<%%= link_to "Forgot password?", new_password_path, class: "text-gray-700 underline" %>
28+
</div>
29+
</div>
30+
<%% end %>
31+
</div>

test/integration/user_journey_test.sh

+12-1
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ bundle add rails --skip-install ${RAILSOPTS:-}
3232
bundle add tailwindcss-rails --path="../.."
3333
bundle install
3434
bundle show --paths
35+
bundle binstubs --all
3536

3637
# install tailwindcss
3738
bin/rails tailwindcss:install
3839

3940
# TEST: tailwind was installed correctly
40-
grep tailwind app/views/layouts/application.html.erb
41+
grep -q tailwind app/views/layouts/application.html.erb
4142

4243
# TEST: rake tasks don't exec (#188)
4344
cat <<EOF >> Rakefile
@@ -47,3 +48,13 @@ end
4748
EOF
4849

4950
bin/rails tailwindcss:build still_here | grep "Rake process did not exit early"
51+
52+
if [[ $(rails -v) > "Rails 8.0.0.beta" ]] ; then
53+
# TEST: presence of the generated file
54+
bin/rails generate authentication
55+
grep -q PasswordsController app/controllers/passwords_controller.rb
56+
fi
57+
58+
# TEST: presence of the generated file
59+
bin/rails generate scaffold post title:string body:text published:boolean
60+
grep -q "Show this post" app/views/posts/index.html.erb

0 commit comments

Comments
 (0)