diff options
author | Matthew Lemon <y@yulqen.org> | 2024-11-11 17:12:50 +0000 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-11-11 17:12:50 +0000 |
commit | 154a9ab32ae1447c191d0b1f565b1e905851a9e2 (patch) | |
tree | cf119820e199181c96cf9b03d15ecdf79644210a | |
parent | b8d7a7cf7e78fe384c6c6e8e6812a252084ce1f0 (diff) |
Adds a Create new account page and part way through configging the form
-rw-r--r-- | app/controllers/registrations_controller.rb | 8 | ||||
-rw-r--r-- | app/views/registrations/new.html.erb | 41 | ||||
-rw-r--r-- | app/views/sessions/new.html.erb | 5 | ||||
-rw-r--r-- | config/routes.rb | 1 |
4 files changed, 55 insertions, 0 deletions
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb new file mode 100644 index 0000000..13ef4dd --- /dev/null +++ b/app/controllers/registrations_controller.rb @@ -0,0 +1,8 @@ +class RegistrationsController < ApplicationController + allow_unauthenticated_access only: %i[ new create ] + def new + end + + def create + end +end
\ No newline at end of file diff --git a/app/views/registrations/new.html.erb b/app/views/registrations/new.html.erb new file mode 100644 index 0000000..eeafa1c --- /dev/null +++ b/app/views/registrations/new.html.erb @@ -0,0 +1,41 @@ +<div class="mx-auto md:w-2/3 w-full"> + <h1 class="font-bold text-4xl text-gray-700">Create account</h1> + + <p class="my-2">Please sign up for your Alphabet Learning account here.</p> + + <% if alert = flash[:alert] %> + <p class="py-2 px-3 bg-red-50 mb-5 text-red-500 font-medium rounded-lg inline-block" id="alert"><%= alert %></p> + <% end %> + + <% if notice = flash[:notice] %> + <p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p> + <% end %> + + <%= form_with url: registration_url, class: "contents" do |form| %> + <div class="my-5"> + <%= form.text_field :first_name, required: true, autofocus: true, autocomplete: "first_name", placeholder: "Enter your first name", value: params[:first_name], class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %> + </div> + + <div class="my-5"> + <%= form.text_field :last_name, required: true, autofocus: true, autocomplete: "last_name", placeholder: "Enter your last name", value: params[:last_name], class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %> + </div> + + <div class="my-5"> + <%= 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" %> + </div> + + <div class="my-5"> + <%= 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" %> + </div> + + <div class="col-span-6 sm:flex sm:items-center sm:gap-4"> + <div class="inline"> + <%= form.submit "Sign in", class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %> + </div> + + <div class="mt-4 text-sm text-gray-500 sm:mt-0"> + <%= link_to "Forgot password?", new_password_path, class: "text-gray-700 underline" %> + </div> + </div> + <% end %> +</div>
\ No newline at end of file diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index 638f9c7..5b87b16 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -28,4 +28,9 @@ </div> </div> <% end %> + + <br/> + + <%= link_to "Create Account", new_registration_path, class: "bg-green-500 text-white p-3 rounded-md" %> + </div> diff --git a/config/routes.rb b/config/routes.rb index af58cd0..66bd997 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,6 +2,7 @@ Rails.application.routes.draw do resources :pdfresources resource :session resources :passwords, param: :token + resource :registration, only: [:new, :create] # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500. |