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

View File

@ -5,6 +5,11 @@
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.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
= f.label :email, class: "block font-bold mb-2 text-gray-700 text-sm"
= 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'