More CSS simplification

Edit domain names, updates credentials and virtuals
Model domain tests for length and valid characters
This commit is contained in:
2024-05-20 12:41:45 +01:00
parent 781b2bb9f0
commit dcd4efdd4e
7 changed files with 50 additions and 5 deletions

View File

@@ -36,8 +36,21 @@ class DomainsController < ApplicationController
# PATCH/PUT /domains/1 or /domains/1.json
def update
pre_domain_name = @domain.domain
respond_to do |format|
if @domain.update(domain_params)
# now we need to update the credentials and virtuals
@domain.credentials.each do |credential|
credential.email.sub! pre_domain_name, @domain.domain
credential.save
end
@domain.virtuals.each do |virtual|
virtual.email.sub! pre_domain_name, @domain.domain
virtual.save
end
format.html { redirect_to domain_url(@domain), notice: "Domain was successfully updated." }
format.json { render :show, status: :ok, location: @domain }
else