Joomla external URL redirect on successful login - authentication

Im looking to override the default joomla login redirect and use an external url on succesful login (which currently doesn't seem possible within the default joomla setup).
I found this support doc:
https://docs.joomla.org/How_do_you_redirect_users_after_a_successful_login%3F
The code I would add would be as follows.. correct?
$redirectUrl = urlencode(base64_encode("http://subdomain.mydomain.com"));
$joomlaLoginUrl = 'index.php?option=com_users&view=login';
$finalUrl = $joomlaLoginUrl . $redirectUrl;
But im not sure where to add this code, in the support doc it says 'in your Administration back end from your custom code'?
Any help would be much appreciated.

The default login module of joomla loads menu item that are published in joomla. So you can create a new menu item using the type "System links -> external url" Put your external url in that menu item.
That menu item will now show up in the module administration. You just need to select it.
You could as well modify the php of the module. The module is called mod_login in the folder modules. You might also consider creating a new module. Download all the files, do your modifications, change the mod_login.xml, in order to change the name of the module, add your name as well etc. Zip the whole folder and then install it through the normal joomla installer. Like this you will not have upgrade issues.
The file to modify is called helper.php in mod_login folder. On line 45 you can edit:
return base64_encode($url);
And change it to:
return base64_encode("http://your.url.com");

Related

Block the user from viewing files in the directory via the url

I'm pretty new in developing for VB.NET. I have a web application and I want to block the access to the files in a directory.
For example:
If the user access the following page: application.com/example/page.aspx
If the user remove the page name and type "application.com/example/", he will see all the files inside the folder "example".
I want to block this possibility and, when a user try to access the files, redirect to an error page.
I know how to solve this in PHP through htaccess, but I have never done it by VB.NET. Any help?
If you are using IIS then
Go to your sites-->Desired Site
From Features Views Select Directory Browsing disabled.
web.config or .htaccess will do.
Remember it is a security risk to have directories open for anyone to see.

Hybris: cannot find CMSSite associated with current URL

I created a new Hybris extension using one of the given templates.
The build was successful and I am able to start the server, too.
But when opening the weblink from the HAC I get the error "Cannot find CMSSite associated with current URL".
Are there suggestions to solve or investigate this issue?
You need to use hosts file mappings or use the site-ID parameter to avoid a 500 error.
Please follow these link
https://wiki.hybris.com/display/accdoc/Just+One+Storefront
https://help.hybris.com/6.3.0/hcd/8ae0711f86691014877ae05249b2f5ac.html (Hybris 6)
If you have administrator rights, it is a good idea to add the following entries in your host file.
127.0.0.1 hybris.local [Example]
The etc hosts modification allows the accelerator to identify sites (CMSSites) from the url. This makes the URL neat and clean.
After host file change, You can access the site like this
http://hybris.local:9001/yacceleratorstorefront/
If you don't do this, the sites would need to be identified with an additional request parameter like this
http://localhost:9001/yacceleratorstorefront/?site=hybris&clear=true
Error "Cannot find CMSSite associated with current URL".
This is because you are not telling hybris which site you want to access.
There are three ways to do that
Simply pass your siteID as a request parameter(?site=SiteID) in your first request which helps the Hybris to understand which site you are trying to access. Let's say I'm trying to access powertools site then URL would be
https://localhost:9002/yacceleratorstorefront?site=powertools
Access site with siteID as DNS name. You can make 127.0.0.1 host with <siteID>.local. Let's say I want to access a powertools (It's CMSSite id for powertools), then add an entry like 127.0.0.1 powertools.local in your host file and then access your site using http://powertools.local:9001/yacceleratorstorefront/ instead of localhost
Add a new regular expression of your choice in the urlPatterns of your CMSSite. So that you can access your site as you want. Let's say I want to access site using localhost URL only and without passing ?site=powertools ever. So I need to add a new regex like (?i)^https?://[^/].*$ to urlPatterns of powertools CMSSite. Now I can directly open powertools site using https://localhost:9002/yacceleratorstorefront/
You can do that using Impex as well
$siteUid=mysite
# CMS Site
INSERT_UPDATE CMSSite ; uid[unique=true] ; urlPatterns ;
; $siteUid ; (?i)^https?://[^/]+(/[^?]*)?\?(.*\&)?(site=$siteUid)(|\&.*)$,(?i)^https?://$siteUid\.[^/]+(|/.*|\?.*)$,(?i)^https?://[^/].*$ ;
Find the detailed answer here
In addition to the host entry, make sure to add the appropriate regular expression for your website.
The CMS site has an attribute called urlPatterns. This is a list of regular expressions that the website CMS filters match to determine which storefront a user is trying to access.
The simplest thing is to add a further regular expression to the CMS site like the one below:
(?i)^https?://[^/]*/yacceleratorstorefront((?![\?\&]site=).)*
At run time, you can can do it in the hybris Management Console(hMC). Navigate to WCMS Website Your Site Name Properties tab and edit URL Patterns section.
To make the change permanent, add the appropriate code to the CMS site setup ImpEx script run during the project data phase of initialization e.g. for electronics storefront
# CMS Site
UPDATE CMSSite;uid[unique=true];urlPatterns;
;electronics;(?i)^https?://[^/]+(/[^?]*)?\?(.*\&)?(site=electronics)(|\&.*)$,(?i)^https?://electronics\.[^/]+(|/.*|\?.*)$,(?i)^https?://api\.hybrisdev\.com(:[\d]+)?/rest.*$,(?i)^https?://[^/]*/yacceleratorstorefront((?![\?\&]site=).)*;
This issue usually comes up if the server was started with unsatisfied spring bean dependencies. Please check your server startup log to confirm which particular bean or beans failed to initialise.

Sitefinity: Need to make a PDF available on a very specific URL but can't do it

I have a website on SiteFinity 4.4. I need to make a document available on a very specific URL, i.e.
http:www.example.com/reports/the-report.pdf
If I just create a directory in the root of the site it does not work (503 error). Also when I try to use the 302Redirect.xml file to redirect the URL to the PDF it does not work either (same error). The link has already been published and has to be exactly as specified. How do I solve this?
Any help would be greatly appreciated.
Sitefinity wouldn't block a folder. Adding a physical folder and dropping that report on the proper place should function, so it probably means you'll have to check your server configuration.
Anyway, the fastest way outside Sitefinity, would be to just create a IIS rewrite rule. Make the http:/www.example.com/reports/the-report.pdf the pattern and redirect them to the url of the document from the sitefinity library.
When you upload a document to the library in sitefinity it gives you an direct url, something like /docs/defaultlibrary/document. You can verify the url by going to content >> documents and files and chose Embed link to this file. That gives you a pop-up with the url.

After moving my Drupal 7 site to another host, modules are appeared without download

I'm sorry for such a complex subject. My problem is.
I tried to move my Drupal 7 site from one server to another.
I uploaded a fresh install to my new site.
I backed up my old database and imported to my new site.
I uploaded settings.php file to my new site.
When i entered to my new site's module part, All the 3rd party modules i installed in my old site, exist in my new site without any loss :)
But when i check the folders
/sites/all/modules
/sites/default
/modules
I couldn't find any file regarding to this modules.
Modules exist in my new site when i check my admin panel, I can create content by using this modules, But i can't see their files by using file manager etc.
Thank you
Because you didn't disable the modules before moving your deployment, I think they're still marked in your database, same for registration of content types. As the modules don't actually exist, you won't get their functionality.
Replacing the modules under /sites/all/modules or /sites/default/modules should leave them working as before.

How to use relative URL's in website with two base URL's

I have our basic corporate static html website installed in our web root directory and our billing software installed in /portal. I have integrated the websites to look like a single site by including the /menu.tpl smarty template file in the /portal/header.tpl file. However, if I use relative URL's, the menu sysem doesnt work as the base url for the billing script is /portal. i.e. if I create a link to faq.php in the menu.tpl and I load a page on the portal site, the link in the menu back to the faq page is now /portal/faq.php whereby if I load a page off the root site the link is just /faq.php as it should be.
The obvious answer is to just use absolute URL's, but I need the site to be portable as I have many developers who need to install and test it.
I cant find anyway to resolve this. Any ideas?
I ran into the same problem as you a while ago, and after trying a lot of dead ends, I finally ended up with the following solution:
For any URL you need to be a chamelion, i.e. change its path depending on the environment, insert a PHP function that writes out the correct URL.
If you include the PHP function from a single central file, then you can change all of the URL's in the entire site automatically, based on a setting, or some pre-detected switch such as the current domain name, etc.
Example:
<?php print_base_url_plus("/menu.php"); ?>
... where print_base_url_plus() is a function which appends the base URL onto the output.
You may find that you have to change some of the URL's to be php, so they are preprocessed by the PHP engine, or, you can alter the web settings so that standard .htm files are piped through the PHP engine, just like .php files.