Patch #13763

Live check of hostname setting

Added by Daniel Felix over 9 years ago. Updated about 9 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:UI
Target version:-

Description

Hi,

this is a small patch, which provides a live check for the hostname setting in the admin menu.

This is just a function, you can attach as many input fields with different regexp as needed.

I defined this to prevent cases like #13352.

Best regards,
Daniel

check_hostname_setting.diff Magnifier - Version 1 (1.8 KB) Daniel Felix, 2013-04-14 15:07

check_hostname_setting_v2.diff Magnifier - Version 2 (1.84 KB) Daniel Felix, 2013-04-14 20:55

valid_host_name.patch Magnifier (916 Bytes) Filou Centrinov, 2013-04-14 21:20


Related issues

Related to Redmine - Defect #13352: Broken links in incoming emails Closed

History

#1 Updated by Daniel Felix over 9 years ago

Forgot the fileupload. ;-)

#2 Updated by Toshi MARUYAMA over 9 years ago

#3 Updated by Daniel Felix over 9 years ago

1. & 2. agreed

3. this script is in thought in addition to the normal validation. The rails validation works after submitting. This script check before the user try to save anything. A combination would be good, as the user won't be bothered to submit each config x-times.

#4 Updated by Daniel Felix over 9 years ago

1. and 2. are corrected now.

#5 Updated by Filou Centrinov over 9 years ago

I think also, that validation has to be done by rails instead of JS. My patch tries to store host values correctly, that means: "<anything>://" or "www" is deleted

#6 Updated by Daniel Felix over 9 years ago

Yes there should be some validation via rails, but this won't be a live check anyway.
The user just can try and error until everything is fine. The frontend should provide a feedback to the client.

By the way, I would prefer this

v = v.gsub(/#{@available_settings[name]['regexp']}/i,'') unless @available_settings[name]['regexp'].blank? && v.blank?

instead of this:

v = v.gsub(/#{@available_settings[name]['regexp']}/i,'') if !@available_settings[name]['regexp'].blank? && !v.blank?

There would be less confusion because of the ommitting of the negotiation.

#7 Updated by Filou Centrinov over 9 years ago

If you want to use unless it would be:

v = v.gsub(/#{@@available_settings[name]['regexp']}/i,'') unless @@available_settings[name]['regexp'].blank? || v.blank?

(De Morgan's law)

#8 Updated by Daniel Felix over 9 years ago

Filou Centrinov wrote:

If you want to use unless it would be:
[...]
(De Morgan's law)

Why @? should be enough? You haven't changed anything instead of your double @?

#9 Updated by Filou Centrinov over 9 years ago

available_settings is definded as static which is definded with "@@". An instance does not exist, so "@" won't work. Try it out.

You haven't changed anything instead of your double @?

I changed your logical conjunction. If you use unless you have to use || instead of && because of De Morgan's law.

#10 Updated by Daniel Felix over 9 years ago

Ah thanks. I haven't noticed the or. :-) this happens if you try to watch at something while your on the jump to your next meeting. :-)

#11 Updated by Daniel Felix about 9 years ago

Hi there,

any news on this hostname validation patch?

I recently noticed this stumbling block as a friend of mine tried to install Redmine in his company.

Best regards,
Daniel

Also available in: Atom PDF