I have a TYPO3 piBase BE extension. I have debuged the code and I got the following issue:
When I have logged into BE with "www", I got value of $GLOBALS['BE_USER']. But when I have logged into BE without "www", I got a blank array in $GLOBALS['BE_USER']->user.
I have tried:
$GLOBALS['BE_USER'] = t3lib_div::makeInstance('t3lib_tsfeBeUserAuth');
$GLOBALS['BE_USER']->start();
But still I got a blank array when login without "www".
Related
I tried to use angular form to validate user's input in a "ionic generated component" but error as mentioned in the title kept occurring.
Angular forms and validations used in "ionic generated pages" are working fine.
Any ideas?
Picture of :
HTML Component
Error
TypeScript Component
I managed to fix this by using the solution here https://stackoverflow.com/a/57251807/9516387
Which is:
You checking for the presence of an error where no error might exist.
You want something like this:
f.email.errors?.required
Or even:
f.email?.errors?.required
Do the same for the password field and anywhere else where the property might not exist when it is first called.
You should try to access it by f.controls.recipientName.errors
I'm building a Laravel 5.5 app, I used the default make:Auth for my authetication and I added an admin role (by just checking if in the DB the column is_admin is true) I wanted to modify the login process by changing the route depending if the user is admin or not, I used the code from the documentation therefore commenting the line protected $redirectTo = '/home';
and replacing it with a function
public function redirectTo(){
// Code here
}
It worked fine, so I started working on something else, then when I tried to login again I was redirected to / automatically, so I tried modifying my code but I would always be redirected to / whatever I changed.
I then chose to go back to just protected $redirectTo = '/home'; and even then I was redirected to /, so I stopped working on it for a few hours.
Went back to it (I had turned off my computer) and now I was redirected to /home, so I modified it to be redirected to / and it worked, but then when I put my function again, it wouldn't work, still always redirected to / even if I went back to protected $redirectTo = '/home'; instead of my function.
So turned off my computer and started again, same thing, it worked at first but after two changes it didn't work anymore. Tried it on another computer, same thing, worked for 2 times and then does not work anymore until I reboot.
For me it looks like a caching issue so I made a little script which does the following
#!/bin/bash
php artisan optimize
php artisan cache:clear
php artisan route:cache
php artisan view:clear
php artisan config:cache
echo "Cache cleared!"
but that did not fix the problem, onlly rebooting does.
Anybody got the same problem?
Thanks!
Answer: do not comment out
Route::get('/', function () {
return view('welcome');
});
in routes/web.php
I'm using felogin - to get it to work I set it up in TypoScript in my root template:
plugin.tx_felogin_pi1 {
storagePid = 40,38,36,35,51
showForgotPasswordLink = 1
redirectMode = groupLogin,userLogin,login,loginError
redirectPageLogout = 6
...
It works fine, except when I try to logout while being on a page with restricted access because then it tries to find that restricted-page and for those cases I set up the install tool to redirect it to a "Page not found" template.
I noticed the logout-form action always points to the page ID I'm currently on:
<form action="index.php?id=49" target="_top" method="post">
so that's not what I want...I would like it to always be action="index.php?id=6" but my redirectPageLogout = 6 line didn't manage to change it.
Anyone an idea how can I change this?
In the felogin html template there's just ###ACTION_URI### and idk where it gets that from in the logout-form but I wanna play by the rules and not change it in the template directly...unless there's no other way.
You need to have access to a login-/logout-plugin after your logout is processed to get the forwarding working.
So if your logout plugin is on a page which is only invisible for logged in user. the logout is processed, but your redirect can't be processed (the default-handling of TYPO3 takes over and throws you to a page which is accessable). The same occurs if only the plugin itself is only visible for logged in users.
if you target the logout form directly to a page with a plugin visible for all, first the logout and secondly the redirect can be processed always.
I have such problem: If page on my sites doesn't exists it always does redirect at main page, but I want to display 404 error.
Example: example.com/sdasadsasad - I see main page. How I can fix it? I tried add in localconfiguration
'pageNotFound_handling' = '/';
'pageNotFound_handling_statheader' = 'HTTP/1.1 404 Not Found';
but it doesn't help.
TYPO3 7.6.11
Look in the description of the install tool for the settings. There is described what setting doing what.
So an String in pageNotFound_handling will fetch the page entered and display this, true or 1 will display an error message.
I recommand to create an error page like example.com/404.html within TYPO3 and enter 404.html in pageNotFound_handling so you can customize the error.
If you want only to shown an error enter trueor 1 in the pageNotFound_handling setting.
We were experiencing the same problem. We have curl enabled ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlUse'] = 1). Due to our configuration, curl was not able to fetch the error page because the SSL certificate could not be verified.
Be careful, the following idea is ugly:
You might find out more about the problem by editing TypoScriptFrontendController.php: Find the function pageErrorHandler (about line 2000 -- who writes such long files?!), find the call to GernalUtility::getUrl() and add as fourth parameter a new array variable. var_dump it instead of the call to HttpUtility::redirect. You should get the curl error if there is one.
Apologies, but I did ask this at the wordpress site but it doesn't seem to get viewed yet alone answered! Hope I'm not breaking any rules by reposting here.
I've been developing a wordpress plugin that has an admin section with a form to add and edit various things. Now after an admin submits the form I wanted to redirect if successful (to show updated values) or show the various error messages if not. I got the header errors from trying wp_redirect and after looking through SO I started to use the add_action method so I could redirect without header error messages. The problem I have now though is that my array of errors is now always null, even if the form wasn't submitted correctly. I have defined the errors variable before add_action and in the function in add_action I have
global $errors;
If I do a var_dump of $errors in the function that handles the submit it is populated, but then on my actual page it is always empty. My guess is that I'm not familiar with the order the pages get called in WP and I'm missing something, but how does anyone else handle this?
//the index.php for pluging
//require necessary files
$errors = null;
include('plugin_file.php');
//Tie into wordpress hooks
add_action('widgets_init', 'plugin::register_func');
add_action('admin_menu', 'plugin::add_menu_item');
add_action('admin_init', 'plugin::check_form_submission');
Then the form submission is similar to
//THE Class file for my plugin
static function check_form_submission(){
global $errors;
if(empty($_POST['some_field'])){
$errors['some-error'] = 'some error';
}
if(!$errors){
//handle and redirect here
}else{
var_dump($errors); // does have values
}
}
In the actual admin page that shows the form
//actual admin page that shows in WP
var_dump($errors); // returns NULL
will always be null even if it has values above. Anyone got any advice how to handle this? I'm new to WP plugin development so not sure what the best practice is.
well it looks like I worked this out.
On the actual admin page I need to declare my $errors array as global as well
global $errors;
I guess wordpress must somehow box the admin page into a function and so the $errors array was not referencing the global var.