Skip to content

MFE-issues-12: support target url for embedded Vanilla, MFE-issesu-11: hide guest block #646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion config/vanilla/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@
$Configuration['Garden']['ForceInputFormatter'] = false;
$Configuration['Garden']['Version'] = 'Undefined';
$Configuration['Garden']['CanProcessImages'] = true;
$Configuration['Garden']['Theme'] = 'topcoder';
// Default Topcoder Theme
//$Configuration['Garden']['Theme'] = 'topcoder';
// MFE Topcoder Theme
$Configuration['Garden']['Theme'] = 'mfe-topcoder';
$Configuration['Garden']['MobileTheme'] = 'topcoder';
$Configuration['Garden']['Profile']['EditPhotos'] = false;
$Configuration['Garden']['SystemUserID'] = '1';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,16 @@ protected function checkOverride($type, $target, $transientKey = null) {
throw new Exception("Unknown entry type $type.");
}

$url = str_ireplace('{target}', rawurlencode(url($target, true)), $url);
// FIX: micro-frontends-forums-app issues-12
$isEmbedded = (bool) c('Garden.Embed.Allow',false);
$remoteUrl = c("Garden.Embed.RemoteUrl");
if($isEmbedded && is_string( $remoteUrl)) {
$targetUrl = rawurlencode($remoteUrl.'/#'.url($target));
} else {
$targetUrl = rawurlencode(url($target, true));
}

$url = str_ireplace('{target}', $targetUrl, $url);

if ($this->deliveryType() == DELIVERY_TYPE_ALL && strcasecmp($this->data('Method'), 'POST') != 0) {
redirectTo(url($url, true), 302, false);
Expand Down Expand Up @@ -1019,7 +1028,16 @@ public function signOut($transientKey = "", $override = "0") {
$this->_setRedirect();
}

$target = url($this->target(), true);
// FIX: micro-frontends-forums-app issues-12
$isEmbedded = (bool) c('Garden.Embed.Allow',false);
$remoteUrl = c("Garden.Embed.RemoteUrl");

if($isEmbedded && is_string( $remoteUrl)) {
$target = rawurlencode($remoteUrl.'/#'.url($this->target()));
} else {
$target = url($this->target(), true);
}

if (!isTrustedDomain($target)) {
$target = Gdn::router()->getDestination('DefaultController');
}
Expand Down
44 changes: 27 additions & 17 deletions vanilla/applications/dashboard/views/modules/guest.php
Original file line number Diff line number Diff line change
@@ -1,30 +1,40 @@
<?php if (!defined('APPLICATION')) exit(); ?>
<?php if (!defined('APPLICATION')) exit();

$isEmbedded = (bool) c('Garden.Embed.Allow',false);
?>
<div class="Box GuestBox">
<h4><?php echo t('Welcome to Topcoder!'); ?></h4>

<p><?php echo t($this->MessageCode, $this->MessageDefault); ?></p>
<p><?php
$message = $isEmbedded?
"Looks like you are new or haven't signed in. Please use the \"Login\" link in the upper right to log into your account.": "Looks like you are new or aren't currently signed in." ;
echo $message;
?></p>

<p><?php $this->fireEvent('BeforeSignInButton'); ?></p>

<?php

$signInUrl = signInUrl($this->_Sender->SelfUrl);

if ($signInUrl) {
echo '<div class="P">';
echo anchor(t('Login'), signInUrl($this->_Sender->SelfUrl), 'Button Primary SignIn BigButton'.(signInPopup() ? ' SignInPopup' : ''), ['rel' => 'nofollow']);
echo '</div>';
}
if(!$isEmbedded) {
if ($signInUrl) {
echo '<div class="P">';
echo anchor(t('Login'), signInUrl($this->_Sender->SelfUrl), 'Button Primary SignIn BigButton'.(signInPopup() ? ' SignInPopup' : ''), ['rel' => 'nofollow']);
echo '</div>';
}

$Url = registerUrl($this->_Sender->SelfUrl);
if (!empty($Url)) {
?>
<p class="SignUpBlock">
<span>Don't have an account?</span>
<?php
echo anchor(t('SIGN UP').sprite('SpArrowRight'), $Url, 'Button SignUp', ['rel' => 'nofollow']);
?>
</p>
<?php
$Url = registerUrl($this->_Sender->SelfUrl);
if (!empty($Url)) {
?>
<p class="SignUpBlock">
<span>Don't have an account?</span>
<?php
echo anchor(t('SIGN UP').sprite('SpArrowRight'), $Url, 'Button SignUp', ['rel' => 'nofollow']);
?>
</p>
<?php
}
}

?>
Expand Down