fix sign up

This commit is contained in:
Torsten 2023-01-22 23:17:59 +02:00
parent 4f33e475e5
commit af824775bb
3 changed files with 12 additions and 36 deletions

View File

@ -5,20 +5,22 @@ class RegistrationsController < Devise::RegistrationsController
# before_action :configure_account_update_params, only: [:update] # before_action :configure_account_update_params, only: [:update]
prepend_before_action :authenticate_scope!, only: [:edit_email] prepend_before_action :authenticate_scope!, only: [:edit_email]
def new def new
build_resource build_resource
super super
end end
# POST /resource
def create def create
if message = math_check if message = math_check
puts message
flash.now.alert = message flash.now.alert = message
end build_resource(sign_up_params)
render :new
else
super super
end end
end
# GET /resource/edit
def edit_email def edit_email
build_resource build_resource
puts "EDIT" puts "EDIT"
@ -28,17 +30,12 @@ class RegistrationsController < Devise::RegistrationsController
build_resource build_resource
super super
end end
# PUT /resource
def update def update
puts "UPDATE" puts "UPDATE"
super super
end end
# DELETE /resource
# def destroy
# super
# end
protected protected
def math_check def math_check

View File

@ -5,6 +5,11 @@
html: { class: "bg-white mb-4 px-8 pt-6 pb-8 rounded shadow-md" } , html: { class: "bg-white mb-4 px-8 pt-6 pb-8 rounded shadow-md" } ,
url: registration_path(resource_name) ) do |f| url: registration_path(resource_name) ) do |f|
= render "devise/shared/error_messages", resource: resource = render "devise/shared/error_messages", resource: resource
.mb-4
= f.label :name, class: "block font-bold mb-2 text-gray-700 text-sm"
= f.input :name,
placeholder: "Pekka Virtanen",
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 .mb-4
= f.label :email, class: "block font-bold mb-2 text-gray-700 text-sm" = f.label :email, class: "block font-bold mb-2 text-gray-700 text-sm"
= f.email_field :email, = f.email_field :email,

View File

@ -1,26 +0,0 @@
= form_for @member do |f|
.flex.flex-col
- if @member.errors.any?
#error_explanation
%h2= "#{pluralize(@member.errors.count, "error")} prohibited this member from being saved:"
%ul
- @member.errors.full_messages.each do |message|
%li= message
.grid.grid-cols-2.m-20.gap-10
.field
= f.label :name
= f.text_field :name
.field
= f.label :picture
= f.file_field :picture
-if @member.picture
%div.overflow-hidden
.my-5 Currently
= image_tag @member.picture, class: "object-contain h-40"
.field
= f.label :Bio
= f.rich_text_area :bio
.flex.justify-center.actions
= f.submit 'Save'