Commit 8e3265d7 authored by Ruben Davila's avatar Ruben Davila

Generate trial licenses through the subscription portal

parent d0c4f2dc
...@@ -17,7 +17,7 @@ class Admin::LicensesController < Admin::ApplicationController ...@@ -17,7 +17,7 @@ class Admin::LicensesController < Admin::ApplicationController
end end
def new def new
@license = License.new build_license
end end
def create def create
...@@ -66,6 +66,10 @@ class Admin::LicensesController < Admin::ApplicationController ...@@ -66,6 +66,10 @@ class Admin::LicensesController < Admin::ApplicationController
redirect_to new_admin_license_path redirect_to new_admin_license_path
end end
def build_license
@license ||= License.new(data: params[:trial_key])
end
def license_params def license_params
license_params = params.require(:license).permit(:data_file, :data) license_params = params.require(:license).permit(:data_file, :data)
license_params.delete(:data) if license_params[:data_file] license_params.delete(:data) if license_params[:data_file]
......
...@@ -59,5 +59,12 @@ module LicenseHelper ...@@ -59,5 +59,12 @@ module LicenseHelper
@current_license = License.current @current_license = License.current
end end
def new_trial_url
uri = URI.parse(Gitlab::SUBSCRIPTIONS_URL)
uri.path = '/trials/new'
uri.query = "return_to=#{Gitlab.config.gitlab.url}"
uri.to_s
end
extend self extend self
end end
...@@ -11,4 +11,4 @@ ...@@ -11,4 +11,4 @@
= custom_icon("missing_license") = custom_icon("missing_license")
%h4 You do not have a license. %h4 You do not have a license.
%p.trial-description You can start a free trial of GitLab Enterprise Edition without any obligation or payment details. %p.trial-description You can start a free trial of GitLab Enterprise Edition without any obligation or payment details.
= link_to 'Start free trial', new_admin_trials_url, class: "btn btn-new btn-start-trial prepend-top-10" = link_to 'Start free trial', new_trial_url, class: "btn btn-new btn-start-trial prepend-top-10"
...@@ -12,5 +12,5 @@ ...@@ -12,5 +12,5 @@
= link_to "Enterprise Edition products", "https://about.gitlab.com/products/", target: "_blank", rel: "noopener noreferrer nofollow" = link_to "Enterprise Edition products", "https://about.gitlab.com/products/", target: "_blank", rel: "noopener noreferrer nofollow"
You can try these out for free without You can try these out for free without
any obligation or payment details. any obligation or payment details.
= link_to new_admin_trials_path, class: "btn btn-new" do = link_to new_trial_url, class: "btn btn-new" do
Start free trial Start free trial
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