Error --> "Can't logout() while you are in login" - jquery-terminal

While using jquery terminal, sometimes if without logging in if I try to call logout() it is throwing me an error like "U can't logout while you are in login". Any idea about this..?

Related

How to debug Laravel app when no error info given at all?

Deployed my Laravel 5.4 app to Heroku and a couple of times I've had the standard "Whoops, looks like something went wrong." exception page with the red banner at the top. Blank white page below that. Nothing in error logs and APP_LOG is set to errorlog and other errors and use of Log::Info() all send to stdout, i.e. Heroku's combined logs and proven to work correctly.
So, just this particular error is generating no info it seems. How to debug this? It's a post to a particular route.
If no logs are being written and the web inspector doesn't give any hints, you can add a dd statement in the app/Exceptions/Handler.php:
public function report(Exception $exception)
{
dd($exception->getMessage());
parent::report($exception);
}
That should print the error message on the page.

Trying to redirect to previous view (with errors) after PostTooLargeException laravel 5.6

**(Laravel 5.6)**After submitting form with file input, laravel throws PostTooLargeException, I want to redirect back to upload view with error message. I found that I can redirect back in Handler.php method render() with:
`if ($exception instanceof \Illuminate\Http\Exceptions\PostTooLargeException)
{
return redirect()->back();
}
`
But I want to redirect with errors which will be shown in upload form view. I have tried all solutions at link below but nothing worked.
Laravel redirect back with() message
Thanks for help.
Here is image of exception:PostTooLargeException
Try increasing the 'post_max_size' in your php.ini file to avoid that exception
For the errors this should work
redirect()->back()->withErrors();
Here's a link that may help you trouble shoot why you are not seeing the errors. https://laracasts.com/discuss/channels/code-review/redirect-with-errors-not-working?page=1

Login using codeigniter without alert error messages

Can Anyone give me a simple CodeIgniter example?
When the login fails, "Unable to login" message as alert. Error message will print near to the text boxes. Anybody can help?
You can use flash message for that.
Define it in your controller when you check login:
$this->session->set_flashdata('loginfail', 'Incorrect username or Password');
redirect('loginpage');
In your view page:
$this->session->flashdata('loginfail'); //write this line where you want to display message.
Let me know if any query....!

Zend\Authentication\Storage\Session Session validation failed, any ideas?

I have a simple authentication code like on a zf2 application
$this->auth = new AuthenticationService(new Session($this->namespace));
and the external modules used are
ZendDeveloperTools
BjyProfiler
Everytime, I try to authenticate, like
$this->auth->authenticate($adapter)
I get a "Session validation failed" error message.
When I disable ZendDeveloperTools module, I do not get this error but couldnot fix. I also checked Zend\Session\Container Session validation failed exception — Object(Closure) ZF2, but I do not have anywhere on my code
$sharedEvents->attach('', '', .. )
as suggested by Crisp
i had a same problem.
Look at:
ZendDeveloperTools/Listener/EventLoggingListenerAggregate.php Line: 64
$events->attach($this->identifiers, '*', array($this,'onCollectEvent'),
Profiler::PRIORITY_EVENT_COLLECTOR);
i uncomment it, then i don't get the error.
Hope it was helpful.

ZF2 Session Validators

I implemented the HttpUserAgent and RemoteAddr validators in Zend Framework 2 to help prevent session hijacking.
use Zend\Session\Validator\HttpUserAgent;
use Zend\Session\SessionManager;
$manager = new SessionManager();
$manager->getValidatorChain()->attach('session.validate', array(new HttpUserAgent(), 'isValid'));
It does seem to stop hijacked sessions however, it doesn't let me display a nice error message or reroute the user to the login page, Instead I get this PHP Error message:
Fatal error: Uncaught exception 'Zend\Session\Exception\RuntimeException'
with message 'Session validation failed' in \zendframework\library\Zend\Session\SessionManager.php on line 111.
Is there a callback or something else that I'm not doing to prevent the code from just dying?
This is php we don't use callbacks, but throw exceptions. You need to catch the exception and handle it from there on out.
I would recommend using the event manager and listening on the dispatch event to validate the user.

Resources