glib-web 0.4.44 → 0.4.45

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40442d04ffd7dc0835cc636f10a30075fa373e71ba7ea77b6d7f4999f394e6cf
4
- data.tar.gz: 590cdf5a3f0a3beef1f4d3b8022b04954839dc90151111bcf44df1567d11eb4d
3
+ metadata.gz: 727dd053b29d3f7cd0240609838c9a4003cdf5273b070087eeeffc2245a3c57b
4
+ data.tar.gz: b8c076c6d5f32bbc2a71d945c13ecf5b71e1d2eec23a3abea48aff16f797ba83
5
5
  SHA512:
6
- metadata.gz: 6f09b3a7ecbb892c23ff2cec794f2410776a8a0e27bd3886a74244c3b8a139782fd5bee378ff9e960a0bbd59490a253d62f3dcdd1fe3a20f6767edf31682b359
7
- data.tar.gz: 85cc1c44d87e5f4d5e3ce3a1c28c4a382aa09ab29710fffbe280e54b7a86871de1fe44005517074fb0a79678f1c83205810470226557b9f44ca26faa8e2cef69
6
+ metadata.gz: 6b40d4670a950a84bd3f9e65ac0b0783b9d50781e2b493d503b1c8fb2e0290ba1f439cd95b144d583cfb8ced20d1d89842dc7c8d12d1d2056a9429449d9960c0
7
+ data.tar.gz: c6228d6a4f503b6f8d51c5015b8cc80cef258aacecd9cff99e09fc9f4d85dafb434c0930ad8f21c7475fbc67732319fcabfe2baa2dc552ea864a81da1593e844
@@ -0,0 +1,7 @@
1
+ class EmailValidator < ActiveModel::EachValidator
2
+ def validate_each(record, attribute, value)
3
+ unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
4
+ record.errors.add(attribute, :invalid)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,20 @@
1
+ class UrlValidator < ActiveModel::EachValidator
2
+ def validate_each(record, attribute, value)
3
+ schemes = ['https', 'http']
4
+
5
+ begin
6
+ uri = URI.parse(value)
7
+ host = uri && uri.host
8
+ scheme = uri && uri.scheme
9
+
10
+ valid_scheme = host && scheme && schemes.include?(scheme)
11
+ valid_raw_url = scheme && value.match?(URI::regexp([scheme]))
12
+
13
+ unless valid_raw_url && valid_scheme
14
+ record.errors.add(attribute, :invalid)
15
+ end
16
+ rescue URI::InvalidURIError
17
+ record.errors.add(attribute, :invalid)
18
+ end
19
+ end
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.44
4
+ version: 0.4.45
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -101,6 +101,8 @@ files:
101
101
  - app/models/glib/dynamic_text_record.rb
102
102
  - app/models/glib/text.rb
103
103
  - app/policies/glib/application_policy.rb
104
+ - app/validators/email_validator.rb
105
+ - app/validators/url_validator.rb
104
106
  - app/views/app/views/json_ui/vue/renderer.html.erb
105
107
  - app/views/json_ui/garage/_nav_menu.json.jbuilder
106
108
  - app/views/json_ui/garage/actions/_dialogs.json.jbuilder