provide dummy email for unauthenticated users

This commit is contained in:
Torsten 2023-10-23 20:20:31 +03:00
parent b30d9d4b20
commit fc79c65b54
6 changed files with 29 additions and 24 deletions

View File

@ -8,7 +8,7 @@ module Merged
def set_image
@card.image_id = params[:image_id].to_i
@card.edit_save(current_member.email)
@card.edit_save(current_member_email)
message = @card.image ? "#{@card.image.name} selected" : "Image removed"
redirect_to section_cards_url(@card.section.id) , notice: message
end
@ -19,26 +19,26 @@ module Merged
else
@card.move_down
end
@card.edit_save(current_member.email)
@card.edit_save(current_member_email)
redirect_to section_cards_url(@card.section.id),notice: "#{@card.header} moved"
end
def new
@section = Section.find(params[:section_id])
new_card = @section.new_card
new_card.add_save(current_member.email)
new_card.add_save(current_member_email)
redirect_to section_cards_url(@section.id) , notice: "Card created"
end
def destroy
@card.delete_and_reset_index(current_member.email)
@card.delete_and_reset_index(current_member_email)
redirect_to section_cards_url(@card.section.id) , notice: "#{@card.header} removed"
end
def update
@card.update(params[:card])
@card.update_options( params[:options])
@card.edit_save(current_member.email)
@card.edit_save(current_member_email)
redirect_to section_cards_url(@card.section_id) , notice: "Updated #{@card.header}"
end

View File

@ -13,7 +13,7 @@ module Merged
else
out = capture("git add merged")
out = capture("git add #{Image.asset_root}" , out)
out = capture("git config --local user.email #{current_member.email}" ,out)
out = capture("git config --local user.email #{current_member_email}" ,out)
out = capture('git commit -m "' + params[:message] + '"' ,out)
out = capture("git pull --rebase=true" ,out)
out = capture("git push" ,out)

View File

@ -19,27 +19,27 @@ module Merged
end
def destroy
@image.destroy(current_member.email)
@image.destroy(current_member_email)
redirect_to :images , notice: "Image #{@image.name} deleted"
end
def update
@image.name = params[:name]
@image.tags = params[:tags]
@image.edit_save(current_member.email)
@image.edit_save(current_member_email)
redirect_to image_path(@image) , notice: "Image updated"
end
def scale
@image.scale( params[:scale] )
@image.edit_save(current_member.email)
@image.edit_save(current_member_email)
redirect_to image_path(@image) , notice: "Image was scaled"
end
def crop
size = "#{params[:size_x]}x#{params[:size_y]}+#{params[:off_x]}+#{params[:off_y]}"
@image.crop( size )
@image.edit_save(current_member.email)
@image.edit_save(current_member_email)
redirect_to image_path(@image) , notice: "Image was resized"
end
@ -52,13 +52,13 @@ module Merged
def copy
image = @image.copy
image.add_save(current_member.email)
image.add_save(current_member_email)
redirect_to image_path(image.id) , notice: "Image copied"
end
def create
image = Image.create_new(params['filename'] ,params['tags'], params['image_file'])
image.add_save current_member.email
image.add_save current_member_email
where_to = determine_redirect(image)
redirect_to where_to , notice: "New image created: #{image.name}"
end

View File

@ -7,5 +7,10 @@ module Merged
return unless respond_to? :"authenticate_member!"
authenticate_member!
end
def current_member_email
return "merged_user" unless respond_to? :current_member
current_member.email
end
end
end

View File

@ -18,7 +18,7 @@ module Merged
def update
if( !params[:name].blank? && (params[:name] != @page.name))
@page.set_name params[:name]
@page.edit_save(current_member.email)
@page.edit_save(current_member_email)
message = "Page renamed"
end
options = params[:option]
@ -26,7 +26,7 @@ module Merged
@page.option_definitions.each do |option|
@page.set_option(option.name, options[option.name])
end
@page.edit_save(current_member.email)
@page.edit_save(current_member_email)
message = "Options saved"
end
redirect_to page_url(@page) , notice: message
@ -39,11 +39,11 @@ module Merged
redirect_to pages_url
else
@page = Page.new_page(name , params[:type])
@page.add_save(current_member.email)
@page.add_save(current_member_email)
template = PageStyle.find_by_type(@page.type).section_template
if(template)
section = @page.new_section(template)
section.add_save(current_member.email)
section.add_save(current_member_email)
redirect_to section_url(section.id) , notice: "Page was successfully created."
else
redirect_to new_page_section_url(@page.id) , notice: "Page was successfully created. Choose first section"
@ -52,7 +52,7 @@ module Merged
end
def destroy
@page.delete_save!(current_member.email)
@page.delete_save!(current_member_email)
redirect_to pages_url, notice: "Page #{@page.name} was removed."
end

View File

@ -18,7 +18,7 @@ module Merged
page = Page.find(params[:page_id])
template = params[:template]
new_section = page.new_section(template)
new_section.add_save(current_member.email)
new_section.add_save(current_member_email)
if(template.blank?) # new
redirect_to section_select_template_url(new_section.id), notice: "New section created"
else # copy
@ -27,13 +27,13 @@ module Merged
end
def destroy
@section.delete_and_reset_index(current_member.email)
@section.delete_and_reset_index(current_member_email)
redirect_to page_sections_url(@section.page.id) , notice: "Section #{@section.header} removed"
end
def set_image
@section.image_id = params[:image_id].to_i
@section.edit_save(current_member.email)
@section.edit_save(current_member_email)
message = @section.image ? "#{@section.image.name} selected" : "Image removed"
redirect_to section_url(@section.id) , notice: message
end
@ -51,7 +51,7 @@ module Merged
@section.card_template = ""
end
@section.set_template( template )
@section.edit_save(current_member.email)
@section.edit_save(current_member_email)
redirect_to section_url(@section.id)
end
@ -59,7 +59,7 @@ module Merged
card_template = params[:card_template]
raise "no card template given" if card_template.blank?
@section.card_template = card_template
@section.edit_save(current_member.email)
@section.edit_save(current_member_email)
redirect_to section_url(@section.id)
end
@ -69,14 +69,14 @@ module Merged
else
@section.move_down
end
@section.edit_save(current_member.email)
@section.edit_save(current_member_email)
redirect_to page_sections_url(@section.page.id)
end
def update
@section.update(params[:section])
@section.update_options( params[:options])
@section.edit_save(current_member.email)
@section.edit_save(current_member_email)
redirect_to :section , notice: "Update ok"
end