Validate format of project_url and token for GitLab CI service.
This commit is contained in:
parent
b351e6f50c
commit
c3e35917fb
1 changed files with 6 additions and 2 deletions
|
@ -22,8 +22,12 @@ class GitlabCiService < CiService
|
|||
API_PREFIX = "api/v1"
|
||||
|
||||
prop_accessor :project_url, :token
|
||||
validates :project_url, presence: true, if: :activated?
|
||||
validates :token, presence: true, if: :activated?
|
||||
validates :project_url,
|
||||
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?
|
||||
|
||||
|
|
Loading…
Reference in a new issue