fix elsewhere

This commit is contained in:
Hub Feenix Member 2023-01-20 20:32:48 +02:00
commit 26173d3a78
11 changed files with 152 additions and 46 deletions

View File

@ -1,6 +1,6 @@
GIT
remote: https://github.com/HubFeenixMakers/merged
revision: 8d650a82ccf70ace63792c4ee42dee9d4327b28b
revision: 05ee69ce24b7c5a593b8c57c87a3e1f8e50f3b32
specs:
merged (0.1.0)
active_hash

View File

@ -0,0 +1,76 @@
# frozen_string_literal: true
class RegistrationsController < Devise::RegistrationsController
# before_action :configure_sign_up_params, only: [:create]
# before_action :configure_account_update_params, only: [:update]
prepend_before_action :authenticate_scope!, only: [:edit_email]
def new
build_resource
super
end
# POST /resource
def create
if message = math_check
flash.now.alert = message
end
super
end
# GET /resource/edit
def edit_email
build_resource
puts "EDIT"
end
def edit
build_resource
super
end
# PUT /resource
def update
puts "UPDATE"
super
end
# DELETE /resource
# def destroy
# super
# end
protected
def math_check
return "no cheatin" unless bot = params[:bot]
return "No food" unless fudder = bot[:fudder]
key = fudder.to_i / 2
answer = bot[:challenge]
return "Plase enter the bot challenge" if answer.blank?
if( (2*key + 1).to_s != answer )
return "Check the maths, tip, it wasn't #{answer}"
end
nil
end
# If you have extra params to permit, append them to the sanitizer.
# def configure_sign_up_params
# devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])
# end
# If you have extra params to permit, append them to the sanitizer.
# def configure_account_update_params
# devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])
# end
# The path used after sign up.
def after_sign_up_path_for(resource)
puts "after sign up"
super(resource)
end
# The path used after sign up for inactive accounts.
# def after_inactive_sign_up_path_for(resource)
# super(resource)
# end
end

View File

@ -1,5 +1,5 @@
.flex.justify-center
.w-full.max-w-xs
.w-full.max-w-xs.md:max-w-md
%h1.font-hairline.mb-6.text-center Resend Confirmation Instructions
= form_for(resource, as: resource_name,
url: confirmation_path(resource_name),
@ -15,6 +15,6 @@
class: "appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none shadow focus:shadow-outline" |
.mb-4
= f.submit "Resend Confirmation Info", |
class: "button bg-blue-500 hover:bg-blue-700 font-bold text-white focus:outline-none py-2 px-4 rounded focus:shadow-outline w-full" |
class: "button bg-cyan-700 hover:bg-cyan-500 font-bold text-white focus:outline-none py-2 px-4 rounded focus:shadow-outline w-full" |
= render "devise/shared/links"
= render "devise/shared/form_footer"

View File

@ -1,5 +1,5 @@
.flex.justify-center
.w-full.max-w-xs
.w-full.max-w-xs.md:max-w-md
%h2.font-hairline.mb-6.text-center Change Your Password
= form_for(resource,
as: resource_name,
@ -27,6 +27,6 @@
class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 mb-3 leading-tight focus:outline-none focus:shadow-outline"
.mb-4
= f.submit "Change My Password", |
class: "button bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline w-full"
class: "button bg-cyan-700 hover:bg-cyan-500 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline w-full"
= render "devise/shared/links"
= render "devise/shared/form_footer"

View File

@ -1,10 +1,10 @@
.flex.justify-center
.w-full.max-w-xs
.w-full.max-w-xs.md:max-w-md
%h1.font-hairline.mb-6.text-center Forgot your password?
= form_for(resource, as: resource_name,
html: { method: :post,
class: "bg-white mb-4 px-8 pt-6 pb-8 rounded shadow-md" } ,
url: password_path(resource_name) ) do |f|
url: password_path(resource_name) ) do |f|
= render "devise/shared/error_messages", resource: resource
.mb-4
= f.label :email, class: "block font-bold mb-2 text-gray-700 text-sm"
@ -12,6 +12,6 @@
class: "appearance-none border leading-tight focus:outline-none px-3 py-2 rounded shadow focus:shadow-outline text-gray-700 w-full" |
.mb-4
= f.submit "Send Password Reset Info", |
class: "button bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline w-full" |
class: "button bg-cyan-700 hover:bg-cyan-500 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline w-full" |
= render "devise/shared/links"
= render "devise/shared/form_footer"

View File

@ -1,26 +1,17 @@
.flex.justify-center
.w-full.max-w-xs
%h1.font-hairline.mb-6.text-center
Edit #{resource_name.to_s.humanize}
.w-full.max-w-xs.md:max-w-md
%h1.font-hairline.mb-6.text-center.text-2xl
Change password
= form_for(resource, as: resource_name,
html: { class: "bg-white mb-4 px-8 pt-6 pb-8 rounded shadow-md",
method: :put } ,
url: registration_path(resource_name) ) do |f|
= render "devise/shared/error_messages", resource: resource
.mb-4
= f.label :email, class: "block font-bold mb-2 text-gray-700 text-sm"
%br/
= f.email_field :email, |
autofocus: true, |
autocomplete: "email", |
class: "appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none shadow focus:shadow-outline" |
- if devise_mapping.confirmable? && resource.pending_reconfirmation?
%div
Currently waiting confirmation for: #{resource.unconfirmed_email}
.mb-4
= f.label :password, class: "block font-bold mb-2 text-gray-700 text-sm"
%i (leave blank if you don't want to change it)
%br/
= f.label :new_password, class: "block font-bold mb-2 text-gray-700 text-sm"
= f.password_field :password, autocomplete: "new-password", class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 mb-3 leading-tight focus:outline-none focus:shadow-outline"
.mb-4
= f.label :password_confirmation, class: "block font-bold mb-2 text-gray-700 text-sm"
@ -33,8 +24,9 @@
autocomplete: "current-password", |
class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 mb-3 leading-tight focus:outline-none focus:shadow-outline" |
.actions
= f.submit "Update", class: "button bg-blue-500 hover:bg-blue-700 font-bold text-white focus:outline-none py-2 px-4 rounded focus:shadow-outline w-full"
%p
Unhappy?
%span= button_to "Delete my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete
= link_to "Back", :back
= f.submit "Update", class: "button bg-cyan-700 hover:bg-cyan-500 font-bold text-white focus:outline-none py-2 px-4 rounded focus:shadow-outline w-full"
.flex.justify-between
%p
%span= button_to "Delete my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete , class: button_classes
%button{class: button_classes}
= link_to "Back", :back

View File

@ -0,0 +1,32 @@
.flex.justify-center
.w-full.max-w-xs.md:max-w-md
%h1.font-hairline.mb-6.text-center.text-2xl
Change your email
.text-center.text-lg
(requires confirmation)
= form_for(resource, as: resource_name,
html: { class: "bg-white mb-4 px-8 pt-6 pb-8 rounded shadow-md",
method: :put } ,
url: registration_path(resource_name) ) do |f|
= render "devise/shared/error_messages", resource: resource
.mb-4
= f.label :new_email, class: "block font-bold mb-2 text-gray-700 text-sm"
%br/
= f.email_field :email, |
autofocus: true, |
autocomplete: "email", |
class: "appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none shadow focus:shadow-outline" |
- if devise_mapping.confirmable? && resource.pending_reconfirmation?
%div
Currently waiting confirmation for: #{resource.unconfirmed_email}
.mb-4
= f.label :current_password, class: "block font-bold mb-2 text-gray-700 text-sm"
= f.password_field :current_password, |
autocomplete: "current-password", |
class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 mb-3 leading-tight focus:outline-none focus:shadow-outline" |
.actions
= f.submit "Update", class: "button bg-cyan-700 hover:bg-cyan-500 font-bold text-white focus:outline-none py-2 px-4 rounded focus:shadow-outline w-full"
= link_to :back do
%button{class: button_classes}
Back

View File

@ -1,16 +1,10 @@
.flex.justify-center
.w-full.max-w-xs
%h1.font-hairline.mb-6.text-center Sign Up
.w-full.max-w-xs.md:max-w-md
%h1.font-hairline.mb-6.text-center.text-2xl Sign Up
= form_for(resource, as: resource_name,
html: { class: "bg-white mb-4 px-8 pt-6 pb-8 rounded shadow-md" } ,
url: registration_path(resource_name) ) do |f|
= render "devise/shared/error_messages", resource: resource
.mb-4
= f.label :name, class: "block font-bold mb-2 text-gray-700 text-sm"
= f.text_field :name,
autocomplete: "name",
placeholder: "Pekka Juustonen",
class: "appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none shadow focus:shadow-outline"
.mb-4
= f.label :email, class: "block font-bold mb-2 text-gray-700 text-sm"
= f.email_field :email,
@ -23,16 +17,22 @@
%small
%em.text-gray-600
(#{@minimum_password_length} characters minimum)
= f.password_field :password, |
autocomplete: "new-password", |
class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 mb-3 leading-tight focus:outline-none focus:shadow-outline" |
= f.password_field :password,
autocomplete: "new-password",
class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 mb-3 leading-tight focus:outline-none focus:shadow-outline"
.mb-4
= f.label :password_confirmation, class: "block font-bold mb-2 text-gray-700 text-sm"
= f.password_field :password_confirmation, |
autocomplete: "new-password", |
class: "appearance-none border leading-tight focus:outline-none px-3 py-2 rounded shadow focus:shadow-outline text-gray-700 w-full" |
.mb-4
= f.submit "Sign Up", |
class: "button bg-blue-500 hover:bg-blue-700 font-bold text-white focus:outline-none py-2 px-4 rounded focus:shadow-outline w-full" |
= f.password_field :password_confirmation,
autocomplete: "new-password",
class: "appearance-none border leading-tight focus:outline-none px-3 py-2 rounded shadow focus:shadow-outline text-gray-700 w-full"
.mt-4
- challenge = rand(8)
= simple_fields_for :bot do |n|
= n.input :fudder , as: :hidden , input_html: { value: "#{challenge*2}" }
= n.input :challenge, placeholder: "Anti bot question: #{challenge} + #{challenge + 1} == " ,
class: " border leading-tight focus:outline-none px-3 py-2 rounded shadow focus:shadow-outline text-gray-700 w-full"
.my-4
= f.submit "Sign Up",
class: "button bg-cyan-700 hover:bg-cyan-700 font-bold text-white focus:outline-none py-2 px-4 rounded focus:shadow-outline w-full"
= render "devise/shared/links"
= render "devise/shared/form_footer"

View File

@ -1,5 +1,5 @@
.flex.justify-center
.w-full.max-w-xs
.w-full.max-w-xs.md:max-w-md
%h1.font-hairline.mb-6.text-center Log In
= form_for(resource, url: session_path(resource_name),
html: { class: "bg-white mb-4 px-8 pt-6 pb-8 rounded shadow-md" },
@ -21,6 +21,6 @@
class: "align-baseline inline-block text-gray-700 text-sm"
.mb-4
= f.submit "Log in",
class: "button bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline w-full"
class: "button bg-cyan-700 hover:bg-cyan-500 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline w-full"
= render "devise/shared/links"
= render "devise/shared/form_footer"

View File

@ -1,7 +1,10 @@
Rails.application.routes.draw do
resources :stories
devise_for :members
devise_for :members ,controllers: { registrations: 'registrations' }
devise_scope :member do
get "/members/edit_email" , to: "registrations#edit_email"
end
resources :members

View File

@ -186,7 +186,10 @@
Tofu\r\n• Cheese\r\n• Flour & yeast\r\n• Peanut butter\r\n• season's fresh and
frozen veggies "
:image_id: 89
<<<<<<< HEAD
:card_template: card_full_image
=======
>>>>>>> 2cfa4d515a4f722214cc2981a17e9d4d759d6d17
- :template: section_cards
:index: 1
:page_id: 9