Project

General

Profile

Actions

Patch #13763

open

Live check of hostname setting

Added by Daniel Felix about 11 years ago. Updated almost 11 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
UI
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

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


Files

check_hostname_setting.diff (1.8 KB) check_hostname_setting.diff Version 1 Daniel Felix, 2013-04-14 15:07
check_hostname_setting_v2.diff (1.84 KB) check_hostname_setting_v2.diff Version 2 Daniel Felix, 2013-04-14 20:55
valid_host_name.patch (916 Bytes) valid_host_name.patch Filou Centrinov, 2013-04-14 21:20

Related issues

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

Actions
Actions #1

Updated by Daniel Felix about 11 years ago

Forgot the fileupload. ;-)

Actions #2

Updated by Toshi MARUYAMA about 11 years ago

Actions #3

Updated by Daniel Felix about 11 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.

Actions #4

Updated by Daniel Felix about 11 years ago

1. and 2. are corrected now.

Actions #5

Updated by Filou Centrinov about 11 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

Actions #6

Updated by Daniel Felix about 11 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.

Actions #7

Updated by Filou Centrinov about 11 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)

Actions #8

Updated by Daniel Felix about 11 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 @?

Actions #9

Updated by Filou Centrinov about 11 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.

Actions #10

Updated by Daniel Felix about 11 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. :-)

Actions #11

Updated by Daniel Felix almost 11 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

Actions

Also available in: Atom PDF