مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2026-01-18 05:49:47 +00:00
initial commit from appmail
هذا الالتزام موجود في:
43
app/controllers/smtp_endpoints_controller.rb
Normal file
43
app/controllers/smtp_endpoints_controller.rb
Normal file
@@ -0,0 +1,43 @@
|
||||
class SMTPEndpointsController < ApplicationController
|
||||
include WithinOrganization
|
||||
before_action { @server = organization.servers.present.find_by_permalink!(params[:server_id]) }
|
||||
before_action { params[:id] && @smtp_endpoint = @server.smtp_endpoints.find_by_uuid!(params[:id]) }
|
||||
|
||||
def index
|
||||
@smtp_endpoints = @server.smtp_endpoints.order(:name).to_a
|
||||
end
|
||||
|
||||
def new
|
||||
@smtp_endpoint = @server.smtp_endpoints.build
|
||||
end
|
||||
|
||||
def create
|
||||
@smtp_endpoint = @server.smtp_endpoints.build(safe_params)
|
||||
if @smtp_endpoint.save
|
||||
flash[:notice] = params[:return_notice] if params[:return_notice].present?
|
||||
redirect_to_with_json [:return_to, [organization, @server, :smtp_endpoints]]
|
||||
else
|
||||
render_form_errors 'new', @smtp_endpoint
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
if @smtp_endpoint.update(safe_params)
|
||||
redirect_to_with_json [organization, @server, :smtp_endpoints]
|
||||
else
|
||||
render_form_errors 'edit', @smtp_endpoint
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@smtp_endpoint.destroy
|
||||
redirect_to_with_json [organization, @server, :smtp_endpoints]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def safe_params
|
||||
params.require(:smtp_endpoint).permit(:name, :hostname, :port, :ssl_mode)
|
||||
end
|
||||
|
||||
end
|
||||
المرجع في مشكلة جديدة
حظر مستخدم