Laravel Nova: The login form is in HTTP instead of HTTPS - laravel

Context
I've installed Laravel Nova, executed the migrations and created the Nova user by following the docs https://nova.laravel.com/docs/3.0/installation.html#installing-nova . Now I'm trying to login.
Expected behavior
When I send the login form, I'm redirected to the backoffice panel.
Actual behavior
When I send the login form, I'm redirected to a Chrome page "This page is not secured, are you sure you want to send your form data?" (approximately the English translation of the French displayed error :D ).
Clues
The login form is shown at this URL: "https://.../nova/login".
The login form, however, contains this action: "http://.../nova/login" - NB: so it's not HTTPS, but HTTP.
Question
Where could I set a Laravel and/or Nova config option to tell Nova to use https instead of http in the action of the login form Nova shows?

Since Nova doesn't seem to use any environment/configuration option to be able to choose the good HTTP/HTTPS protocol, I've directly written the following, in app/Providers/AppServiceProvider (NB: I don't really know the drawbacks of this solution so I don't recommend you to do it, even if in my case it worked well to fix this bug):
public function boot()
{
\URL::forceScheme('https');
}

Related

Building on Laravel API backend and Vuejs frontend

I would require a little help here if this method will work out well.
Firstly, I have a backend API server created using Laravel and Laravel Passport. Secondly, I have also created the frontend with Vuejs within the same project. As such, I will be required to use both the api.php and web.php routes. I am also redirecting these routes using vue-router.
Backend
Inside the web.php routes, I have used two different routes because I want to display generic contents on my landing site and the other as an authentication required dashboard.
Example:
web.php
As above, this is to capture the routes which are 404 Not Found that are directly manipulated in the address bar to redirect correctly to their respective pages. I also ended up having two different blade templates named as dashboard.blade.php and home.blade.php respectively. Is this an okay practice for a Laravel-Vuejs project? Or are there ways that you would like to recommend?
dashboard.blade.php
home.blade.php
Login related problem with login page using the layout of the landing page into another layout of the dashboard page
The problem that I am faced with when doing an API login with the password grant is that the login page does not redirect to the dashboard page properly. The URL route does change but the page is rendered as blank.
The login using axios here:
I have managed to fix the problem.
In web.php, since we have
Route::get('/dashboard/{any?}', function () {
return view('dashboard');
})->where('any', '^(?!.*api).*$[\/\w\.-]*');
Inside of my Login.vue redirect handler, I use location.href = '/dashboard' instead of this.$router.push('dashboard').

Redirecting all pages in laravel

Ok
So I have a simple page with not many functions as I have been working on the front end but I am now ready to start implementing features and the first feature I want to put in is where a certified admin could press a button on the page and it makes every page redirect to a page that says the site is in maintenance mode
Now I already have the Authentication sorted out for the admin and auth is used.
What could I do?
Create this route:
Route::get('/down', function(){
Artisan::call('down');
});
And then create a button in a view that leads to '/down'. Your website will turn to maintenance mode.
You might want to protect that route with a middleware. To go back to normal mode, you'll have to execute php artisan up in the terminal, since all the website will be frozen.

how to make sub folder for login page and rest of the pages in codeigniter

I am working in a codeigniter project in wamp server.
My current login page is http://localhost/flowers/login and its working correctly (no issue). The rest of the urls are like this
http://localhost/handycheck/admin/dashboard etc
My issue is i need to change the login url like this
http://localhost/flowers/admin/login
&
http://localhost/flowers/providers/login
Its because I have to maintain login form for multiple users.
How can i make this.
Please help me and thanks in advance who helps me alot..
You can do this by adding custom roue in codeigniter routing configuration as follows go to config/routes and add the following entry in this file
$route['flowers/providers/login'] = 'flowers/login';
$route['flowers/admin/login'] = 'flowers/login';
this will redirect the request to the login in flowers controller and if you need to do custom handling for admins and provider you can get the url segments and do custom handling according to user type
I hope my answer would be useful

Magento site redirects to home page when ssl is enabled

I am using magento 1.8.1.0 and i have enabled SSL. SSL is purcahsed from Godady and is installed and configured at the server.
I have also set the Base URL in secure section to https://..... . Now when i enable it for front end, and then when i try to go to customer login page (which is served by https), i am always redirected to home page.
I have applied a few fixes, but no one worked.
The fix described on the below link starts a redirect loop and the site never loads.
Magento HTTPS on all website: urls redirect to homepage
Also i have read the following:
http://www.aschroder.com/2012/07/magento-ssl-offloading-with-amazon-elb/
https://magento.stackexchange.com/questions/38250/ssl-issues-with-magento-behind-load-balancer-302-loop
http://blog.ideaday.de/max/2012/12/magento-https-redirect-loop-ssl-offloading-proxies-pound-nginx/
https://www.sonassi.com/knowledge-base/magento-kb/magento-https-redirect-loop/
http://magentocoder.jigneshpatel.co.in/magento-redirection-loop-problem-after-installing-ssl/
And no fix is working for me.
Now i am offering a 50 points bounty for the correct answer.
Can someone give me some idea how to fix this issue?
Thank you
I saw this problem while on a login form submitted via ajax, the login form was loaded as part of a http page as opposed to https, which is not good, and then the login form data submitted by ajax to a https controller url. on success some javascript would try to load a https landing page into the main window.
The problem was magento would redirect the landing page which is what you're experiencing.
To solve hte issues, we loaded the login form by https and dynamically put it into the dom. We used the form action to a https link, and a form submit rather than an ajax post. Then the magento controller would use a redirect in the response to the landing page or an error page.
Go to Your system->confi->web->Session Validation Settings
Validate HTTP_X_FORWARDED_FOR and Validate HTTP_USER_AGENT
this two fields are enable so only disable it ! :)

How do I change the index page in a CodeIgniter anchor?

So, I have two different applications in my CodeIgniter installation. One is admin, the other is frontend. I basically just copied the index file, renamed it "admin.php", and changed the application directory to "application/admin". I then changed the application directory in index.php to "application/frontend".
What I would like to do is create a link on the frontend application that takes you to the admin application. The variable config['index_page'] in the frontend application is set to "index.php" and in the admin application it's set to "admin.php".
Is there a way to set the url helper to use "admin.php" instead of "index.php"?
You don't need to do that way.
you should make or use an authentication library and you set different roles for different
users.
you just after login can put the redirection to your admin controller.
and for other users and viewers you can redirect them to any other controllers.
for viewers you can just use something like this:
Code:
if(!$this->m_auth->is_logged_in())
{
$this->viewers();
}
else
{
$this->users();
}
In your users function you just check different roles and redirect according.
I think you are missing some codeigniter concept, and you are trying to do it the normal way, i suggest you to read this article , you will how you can use MY_Controller as same concept of front controller and how you will be able to give every use specific roles
another way is to use a ready made authentication library as #medhi said
I would recommend Tank Authentication or Ion Auth
I

Resources