Single Signin For All Subdomain Or Projects? - laravel-5

Hy All Hope All Are Fine. First Of All Sorry For My English And I Am Totally New And didn't Know About Php My Sql Etc, So Lets Start My Questions With Detail I Purchased too many Projects
subdomain1.maindomain
subdomain2.maindomain
subdomain3.maindomain
subdomain4.maindomain
May Be In Future I Will Add More
Now Simply I Want Single Login For All Subdomains, Mean That User Can Signup In One Of Any Domain But Can Login For All Subdomain As Same Signup For any One Of Above Domain. My Sql Database User Is Same But Mysql Database Is Different One From Other Every Subdomain or Domain Has It's Own Database.
Please Tell Me Is It Possible To Login As A One???? Please If It Is Possible Share With Detail Because I Am New.
I Did't Try Any Method

Related

Laravel Multihauth: To be or Not to Be?

I am building an app and will need multi auth to works well. First, users that will log as employees using table users with email and password. I´m using Voyager as backend and using roles and permissions. So far, so good. Now I have another kind of user: they are registered on an ERP and I reach then via WS using CPF (like the social-secure number) and password stored in ERP. Then I get then and record at a table all the data I need. It is working well as good. Well, was working. For those users, I used the API route, just not to make a mess on my web routes file. Yesterday I ran PHP artisan make:auth and that´s when things start to get crazy.
Every axios call now returns me an 'unauthorized' message cause, obviously, they´re not authenticated.
What would be better?
Refactory Users login to use CPF instead of email and give a new role for those others API guys and make then pass trough web.php file like everybody?
Use a multiauth package?
Or anything else?
Please, help!
To me, a user is a user. It seems to be a common thing that if an application has more than one “type” of user, that developers instantly start creating multiple Eloquent models, then guards, then controllers, then views, and so on; and then find themselves in a mess when they need a route that can be accessed by more than one type of user.
Instead, elevate “type” to its own model and add it as a relation to your User model. If a user can only be of one type, then make it a one-to-many relation. If a user can have many roles, then make it a belongs-to-many relation. You then use authorization to determine whether a user can access a route based on the role(s) they have.

Multiple sites link to one back end, how to track which site traffic came from in laravel?

I have this web service that I'm trying to offer to multiple businesses of the same genre. They are all individual businesses not affiliated with each other but they can all use one database for submitting info. I basically want to put a link on each separate website that these businesses already have that will point a user to a generic login form that will dump their info into my database and track which company they came from. So if a user goes to Company A and clicks "sign up", i want it to take them to the sign up form but on the back end I'll know to put Company A's credentials with the user affiliation. Likewise if they went to Company B, i'd associate them with Company B. I don't know how to go about doing this in Laravel. Can i generate a custom URL for each company? if so, how do i do that so that i can track the company info? Side note: every company who uses this would also have a company profile with all their info already in my system. Could i create a database column for "company URL" and throw an if statement saying "if url==company A, do 'this'"? I just need a good direction to start in. thanks in advance.
You can add a header to the request going to Laravel says which company the request came from
Company model has many users and User model belongs to company change your routes of Login and Register Controllers to add company on your requests
https://laravel.com/docs/5.6/eloquent-relationships#one-to-many

Many domains with the same site, each one with it's own db

for a project i need to run multiple copies of the same web site, each one on a different domain with a different database.
I plan of doing that this way
create an hosting for each website with a personal database and a website
keep the code updated across the websites using git
update the database using an orm
The problem is that i need an unique login page across the various sites.
I think that the user enter the username on a main site and then it' redirected on the personal site where he insert his password, but this way i have to keep in sync the login data.
How can i achieve this?

Magento Password Reset Link

We run a multi-store/view magento site. Let's say our site is called www.domain.com (running the "retail" store) and another url trade.domain.com running the "trade" store
When a customer requests a password reset from trade.domain.com, they get a password reset link like this: http://trade.domain.com/customer/account/resetpassword/?id=12&token=84fb6f65548995191e526b815982bf23
Clicking this link re-directs to login page with the error Your password reset link has expired..
However, if you replace the "trade" from the domain with "www" like this: http://www.domain.com/customer/account/resetpassword/?id=12&token=84fb6f65548995191e526b815982bf23
The password reset appears to be working correctly.
Any idea why this is happening? Have I configured the magento incorrectly? Is this a known bug?
Customers are shared either per website, either across all websites, so at least, a customer account is usable on all of the store views that a website contains. Consequently, it is normal that the password reset link works for your store views.
In fact, if you would like to separate the customer accounts between your store views, you would have to create separate websites that would not share customers.
Is that subdomain password protected? That could be a problem or if subdomain is set up with a password protected extension, they won't be able to access example.com/customer/account/changeforgotten/ without already being logged in. So you'll have to allow them access to that url first otherwise it'll keep redirecting. I had the same problem.
Check the cookie domain for the website trade.domain.com. In Magento 1 it's in System->Configuration->Web->Session Cookie Management. (Making sure that you change the scope in the top left to the Website you want to update it for.
I have a store that has multiple websites, each with their own view and does not share accounts across websites, and had the same problem. Changing the cookie path fixed it for me.

What is the Preferred Method to having multiple websites share checkout sessions

I have implemented many multi site implementations in the past, so I get how to set up the environment. What I haven't done, is set up multiple websites that can share the same cart session.
So if you are on site1.com and add something to your cart or are logged on, when you go to site2.com you are logged in and have the same items in your cart.
From what I read around the forums, well there isn't much about the best way to share session. But I do know that using the configuration to enable SID on the frontend will pass the session id if you transfer between sites. I figured this is all you need to have, but I see where people are saying that only stores can share checkout sessions and that stores can have their own domain.
I am thinking the best way to do this is to setup multiple websites not one website multiple stores and then just make sure when linking to the other site, I use proper magento url methods to build out the link and it will pass over the SID and the users session will be transferred over.
Is this the preferred way to do this? Is there anything I need to know in terms of configuration? Is there any negatives doing it this? Is there a better way?,
Well if you want to have such possibility only for logged customers then i propose to you to use sales_flat_quote table which is represented by Mage::getModel('sales/quote').
With this model you can manage cart and focus only in passing customer identifier which would bring us to security subject... How would you pass customer identifier in secure way as SID isn't very secure.
Plus SEO doesn't like SID in URL from what i've heard.

Resources