Skip to content

Commit

Permalink
Merge pull request #1074 from proditis/master
Browse files Browse the repository at this point in the history
Force HTTPS & add default value and range for player_type of challenge/question
  • Loading branch information
proditis authored Dec 4, 2023
2 parents 7f8df82 + 0ae3191 commit f5ba69f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion backend/modules/gameplay/models/Challenge.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public function rules()
[['file'], 'file'],
[['name', 'category', 'difficulty', 'filename'], 'string', 'max' => 255],
[['name'], 'unique'],
[['player_type'],'default', 'value'=>'offense']
[['player_type'],'default', 'value'=>'offense'],
['player_type', 'in', 'range' => ['offense', 'defense','both']],
];
}

Expand Down
4 changes: 3 additions & 1 deletion backend/modules/gameplay/models/Question.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ public function rules()
return [
[['challenge_id'], 'required'],
[['challenge_id', 'weight'], 'integer'],
[['weight'], 'default', 'value'=> 0],
[['description', 'player_type'], 'string'],
[['points'], 'number'],
['player_type', 'in', 'range' => ['offense', 'defense','both']],
[['name'], 'string', 'max' => 255],
[['code'], 'string', 'max' => 128],
[['challenge_id', 'name'], 'unique', 'targetAttribute' => ['challenge_id', 'name']],
[['challenge_id'], 'exist', 'skipOnError' => true, 'targetClass' => Challenge::class, 'targetAttribute' => ['challenge_id' => 'id']],
[['weight','points'], 'default', 'value'=> 0],
[['player_type'],'default', 'value'=>'offense'],
];
}

Expand Down
1 change: 1 addition & 0 deletions docs/Sysconfig-Keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
* `target_updated_days`: How many days the target is considered as `updated` on the frontend after update
* `discord_news_webhook`: A discord webhook url to send news and announcements to
* `pf_state_limits`: The content to be appended to the pass rules that enforces limits (default: `(max 10000, source-track rule, max-src-nodes 5, max-src-states 2000, max-src-conn 50)`)
* `force_https_urls`: Force URL generation to always be https (sets `_SERVER['HTTPS']=on`)

## mail configuration
* `mail_from` Email address used to send registration and password reset mails from
Expand Down
5 changes: 4 additions & 1 deletion frontend/config/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,10 @@
],
'params' => $params,
'on beforeRequest' => function ($event) {
if (Yii::$app->sys->maintenance === true) {
if(\Yii::$app->sys->force_https_urls!==false){
$_SERVER['HTTPS']='on';
}
if (\Yii::$app->sys->maintenance === true) {
if (Yii::$app->user->isGuest || !Yii::$app->user->identity->isAdmin ) {
Yii::$app->catchAll = [ 'site/maintenance' ];
}
Expand Down

0 comments on commit f5ba69f

Please sign in to comment.