OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Rename EnterpriseTrialToken and method in controller
Inga Mai8380fe5d5999
diff --git a/app/controllers/enterprises_controller.rb b/app/controllers/enterprises_controller.rbindex 96850fef502..e203e3bf58f 100644--- a/app/controllers/enterprises_controller.rb+++ b/app/controllers/enterprises_controller.rb@@ -59,19 +59,21 @@ class EnterprisesController < ApplicationControllerif tokentoken.destroyflash[:notice] = t(:notice_successful_delete)+ trial_key = Token::EnterpriseTrialKey.find_by(user_id: current_user.id)+ trial_key.destroyredirect_to action: :showelserender_404endend- def create_trial_key+ def save_trial_key@trial_key = params[:trial_key]- Token::EnterpriseTrialToken.create(user_id: current_user.id, value: @trial_key)+ Token::EnterpriseTrialKey.create(user_id: current_user.id, value: @trial_key)enddef initialize_gon- @trial_key = Token::EnterpriseTrialToken.find_by!(user_id: current_user.id)+ @trial_key = Token::EnterpriseTrialKey.find_by(user_id: current_user.id)if @trial_keygon.ee_trial_key = {value: @trial_key.valuediff --git a/app/models/token/enterprise_trial_token.rb b/app/models/token/enterprise_trial_key.rbsimilarity index 97%rename from app/models/token/enterprise_trial_token.rbrename to app/models/token/enterprise_trial_key.rbindex 0a06d4c096c..c4602a54e3a 100644--- a/app/models/token/enterprise_trial_token.rb+++ b/app/models/token/enterprise_trial_key.rb@@ -31,7 +31,7 @@require_dependency 'token/base'module Token- class EnterpriseTrialToken < Base+ class EnterpriseTrialKey < Baseinclude ExpirableTokendef self.validity_timediff --git a/config/routes.rb b/config/routes.rbindex f8741dae1f3..41bda7036c5 100644--- a/config/routes.rb+++ b/config/routes.rb@@ -341,7 +341,7 @@ OpenProject::Application.routes.draw doconstraints(Enterprise) doresource :enterprise, only: %i[show create destroy]scope controller: 'enterprises' do- post 'enterprise/create_trial_key' => 'enterprises#create_trial_key'+ post 'enterprise/save_trial_key' => 'enterprises#save_trial_key'endendresources :enumerationsdiff --git a/frontend/src/app/components/enterprise/enterprise-trial.service.ts b/frontend/src/app/components/enterprise/enterprise-trial.service.tsindex 6c7032c1325..b62e5bd37bd 100644--- a/frontend/src/app/components/enterprise/enterprise-trial.service.ts+++ b/frontend/src/app/components/enterprise/enterprise-trial.service.ts@@ -81,8 +81,6 @@ export class EnterpriseTrialService {.then((res:any) => {// show confirmed status and enable continue btnthis.confirmed = true;- // delete trial key from gon after mail was confirmed- (window as any).gon.ee_trial_key = undefined;// returns token if mail was confirmed// -> if token is new (token_retrieved: false) save token in backend@@ -126,7 +124,7 @@ export class EnterpriseTrialService {let trialKey = resendlink.split('/')[6];// save requested tokenreturn this.http.post(- this.pathHelper.api.v3.appBasePath + '/admin/enterprise/create_trial_key',+ this.pathHelper.api.v3.appBasePath + '/admin/enterprise/save_trial_key',{ trial_key: trialKey },{ withCredentials: true })