1
0
مراية لـ https://github.com/postalserver/postal.git تم المزامنة 2026-01-16 21:23:37 +00:00

fix: don't use authentication on org & server deletion

هذا الالتزام موجود في:
Adam Cooke
2024-03-14 14:14:59 +00:00
الأصل 3d208d632f
التزام be456523dd
4 ملفات معدلة مع 13 إضافات و16 حذوفات

عرض الملف

@@ -43,10 +43,11 @@ class OrganizationsController < ApplicationController
end end
def destroy def destroy
unless current_user.authenticate(params[:password]) if params[:confirm_text].blank? || params[:confirm_text].downcase.strip != organization.name.downcase.strip
respond_to do |wants| respond_to do |wants|
wants.html { redirect_to organization_delete_path(@organization), alert: "The password you entered was not valid. Please check and try again." } alert_text = "The text you entered does not match the organization name. Please check and try again."
wants.json { render json: { alert: "The password you entered was invalid. Please check and try again." } } wants.html { redirect_to organization_delete_path(@organization), alert: alert_text }
wants.json { render json: { alert: alert_text } }
end end
return return
end end

عرض الملف

@@ -65,17 +65,15 @@ class ServersController < ApplicationController
end end
def destroy def destroy
unless current_user.authenticate(params[:password]) if params[:confirm_text].blank? || params[:confirm_text].downcase.strip != @server.name.downcase.strip
respond_to do |wants| respond_to do |wants|
wants.html do alert_text = "The text you entered does not match the server name. Please check and try again."
redirect_to [:delete, organization, @server], alert: "The password you entered was not valid. Please check and try again." wants.html { redirect_to organization_delete_path(@organization), alert: alert_text }
end wants.json { render json: { alert: alert_text } }
wants.json do
render json: { alert: "The password you entere was invalid. Please check and try again" }
end
end end
return return
end end
@server.soft_destroy @server.soft_destroy
redirect_to_with_json organization_root_path(organization), notice: "#{@server.name} has been deleted successfully" redirect_to_with_json organization_root_path(organization), notice: "#{@server.name} has been deleted successfully"
end end

عرض الملف

@@ -13,12 +13,11 @@
all its mail servers & data will be deleted from our systems. all its mail servers & data will be deleted from our systems.
.dangerZone .dangerZone
%p.pageContent__text.u-margin %p.pageContent__text.u-margin
To continue to delete this organization, please enter your password in the field below and press To continue to delete this organization, please enter the name of the organization in the field below and press
continue. <b class='u-red'>There will be no other confirmations.</b> continue. <b class='u-red'>There will be no other confirmations.</b>
= form_tag [organization, :delete], :method => :delete, :remote => true do = form_tag [organization, :delete], :method => :delete, :remote => true do
= hidden_field_tag 'return_to', params[:return_to] = hidden_field_tag 'return_to', params[:return_to]
%p.u-margin %p.u-margin
= password_field_tag "password", '', :class => 'input input--text input--danger' = text_field_tag "confirm_text", '', :class => 'input input--text input--danger'
.buttonSet.u-center .buttonSet.u-center
= submit_tag "Delete this organization, mail servers and all messages", :class => 'button button--danger js-form-submit' = submit_tag "Delete this organization, mail servers and all messages", :class => 'button button--danger js-form-submit'

عرض الملف

@@ -10,12 +10,11 @@
immediately. immediately.
.dangerZone .dangerZone
%p.pageContent__text.u-margin %p.pageContent__text.u-margin
To continue to remove this server, please enter your password in the field below and press To continue to remove this server, please enter the server name in the field below and press
continue. <b class='u-red'>There will be no other confirmations.</b> continue. <b class='u-red'>There will be no other confirmations.</b>
= form_tag [organization, @server], :remote => true, :method => :delete do = form_tag [organization, @server], :remote => true, :method => :delete do
= hidden_field_tag 'return_to', params[:return_to] = hidden_field_tag 'return_to', params[:return_to]
%p.u-margin %p.u-margin
= password_field_tag "password", '', :class => 'input input--text input--danger' = text_field_tag "confirm_text", '', :class => 'input input--text input--danger'
.buttonSet.u-center .buttonSet.u-center
= submit_tag "Delete this mail server and all messages", :class => 'button button--danger' = submit_tag "Delete this mail server and all messages", :class => 'button button--danger'