Commit c3e35917 authored by Marin Jankovski's avatar Marin Jankovski

Validate format of project_url and token for GitLab CI service.

parent b351e6f5
...@@ -22,8 +22,12 @@ class GitlabCiService < CiService ...@@ -22,8 +22,12 @@ class GitlabCiService < CiService
API_PREFIX = "api/v1" API_PREFIX = "api/v1"
prop_accessor :project_url, :token prop_accessor :project_url, :token
validates :project_url, presence: true, if: :activated? validates :project_url,
validates :token, presence: true, if: :activated? presence: true,
format: { with: /\A#{URI.regexp(%w(http https))}\z/, message: "should be a valid url" }, if: :activated?
validates :token,
presence: true,
format: { with: /\A([A-Za-z0-9]+)\z/ }, if: :activated?
after_save :compose_service_hook, if: :activated? after_save :compose_service_hook, if: :activated?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment