Patch #13763
openLive check of hostname setting
Added by Daniel Felix over 11 years ago. Updated over 11 years ago.
0%
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
Updated by Daniel Felix over 11 years ago
Forgot the fileupload. ;-)
Updated by Toshi MARUYAMA over 11 years ago
- Please use two spaces instead of tabs for intends.
- Please use "javascript_tag" instead of <script type="text/javascript">, refer r10371.
- I think that Rails validates_format_of is better than JS.
refer: source:tags/2.3.0/app/models/repository/subversion.rb#L23
Updated by Daniel Felix over 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.
Updated by Daniel Felix over 11 years ago
1. and 2. are corrected now.
Updated by Filou Centrinov over 11 years ago
- File valid_host_name.patch valid_host_name.patch added
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
Updated by Daniel Felix over 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.
Updated by Filou Centrinov over 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)
Updated by Daniel Felix over 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 @?
Updated by Filou Centrinov over 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.
Updated by Daniel Felix over 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. :-)
Updated by Daniel Felix over 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