How to activate company accounts through email after creating the company. RAILS - angularjs

so this is my first question here in stackoverflow, i always find the answer by looking here... so.
I have this issue, I have a Model named Company, which can have many users, which would be the "best approach" to create and activate a user account within this newly created Company.
Here is the process i am following:
Platform Admin creates a company, the company serves as a grouping account in which i will have a number of users, but i need to send an Email after company creation to the Company admin in order to have him create his account so that he can manage the other company users, this email needs to have a hash so that it has some kind of reference to the company (avoiding the company selection in the form).
Im using Rails 4.2.6 and Angular 1.5
so im stuck after the company creation form.

In an email send the angular route url which got the company hash that just created. When admin user clicks on that link your angular route gets called and then before it render the view , i mean use resolve in angularjs route, get the list of all the user and company that just got created where admin user can select user that he or she want to activate.

Related

How to generate links for profile completion with expiry date in NextJS - Supabase

I'm currently working on a NextJS-Supabase project where I have to build a dashboard for some vendors.
Each vendor should be able to login into his dashboard and add his customers to keep track of their informations. The process of adding a customer falls into the following steps :
fill the customer email and submit the request of adding him.
The customer receives an email containing a link available for 5hours.
The link redirects him to a page where he can complete some of his basic information such as address, phone...etc.
Once the form submitted the customer data are updated in Supabase.
I don't know how to implement this in NextJS-Supabase knowing that the customers don't have a user account. Only vendors have a user account and can login/logout.

About Firebase Authentication with React

I'm doing this project these days and for that, I'm using firebase with React. In my project, I have two types of users 1. Student and 2. teacher, so in my site I want to use the same email id to create an account of both the stakeholders from one user, but firebase is not allowing me because I can create only one account using CREATEUSERWITHEMAILANDPASSWORD() method. so how can I create a teacher account if I already have a student account with one email id??
I know this question sounds childish but I am still learning.
so please help me out.
If you go to https://console.firebase.google.com/project/your-project-name/authentication/providers and scroll down to advanced, you can find a setting for allowing only one or multiple accounts per email.
You cannot, however, create multiple accounts with the same login method. So you cannot have users create two accounts with email & password. One account could be with email & password and another could be Facebook login, for example.

Database scheme for user logging with different accounts

currently I need to provide web site logging for different social accounts (facebook, google, twitter and so on).
I know that stackoverflow has same system and I wonder if there is stackoverflow database model in public access. So I can find right way to store user data in my db.
Currently I have next problems.
So, I have my table for users:
UserID
UserName
RegistrationDate
Email
Rating
For users who create account with web site form I use next additional info:
Password
FirstName
LastName
Avatar
I stock in question how to store data for users who login with social networks and what should I store.
It seems that I dont need to store facebook name, surname and so on. I thought about getting it with js on pages where I need it.
Also I am thinking how to provide user with adding facebook, twitter references and so on for his profile.
P.S.
I am using DotNetOpenAuth for user authentication via social networks. Working with asp.net MVC 3.
About functionality on my web site:
just adding articles and rating for user.
For comments I use https://disqus.com/.
Ideally, you should have two tables. One for Users and one for Identities. In the Users table, you store things like your application user id, name, emails, etc. In the Identities table, you link back to the person in the User's table, but have a 'network' field that says which network the Identities row is for (e.g. Facebook, Google, Twitter, etc).
The Identities table can store the User ID and details specific to that platform, e.g. User_ID for Facebook, Twitter username, etc. The user will have one entry in the Users table, but can have many entries in the Identities table, depending on how many networks the user has connected with.

How to make payment to store business account byu paypal?

I am developing an mobile app where I present products (items) from different stores just like ebay.com. User can select product, can add to cart and then finally can make payment via paypal.
I have created an Paypal business account on sandbox. Currently all payment made by users are coming to this business account I mentioned in my code. But my requirement is different. I want that payment should go to store's (product owner's) account.
So I made changes so that whenever i make call to paypal I chnaged business account email to store owner email address and payment done successfully. :) Payment posted to store owner business.
I made changes only in paypal.recipient email address but still paypal object is created by my paypal application ID. This is what I am worried about. Does it will work on production mode? I really doubt that.
Please help me guys!!!
What API or service are you using to do this? Are you just using Website Payments Standard, Exprses Checkout, or one of the other API? You mentiioned application id, are you using Adaptive Payments? You could use Adative Payments to do what you are wanting to, if you are not already doing this. This would allow you to process payments and split it between different accounts. In your business model, it would allow you to split the payments between different store owners if the buyers checkout contained items from different merchants/stores.

Do I need to insert one fake row in database?

I have few tables like example.
Users Books UsersBookPurchase
UID BookId UserId
UName Name BookId
Password Price
Email
This is fine. I am having my own login system but i am also using some 3rd party to validate like OpenID or facebook Authetication. My question is if the user is able to log in successfully using OpenID or facebook Authentication, what steps do i need to do i.e do i have to insert one fake row in Users table because if i do not insert how will integrity be maintained. I mean what user id should i insert in UsersBookPurchase when the person who has logged in using Facebook Authentication has made a purchase because the UserId is reference key from Users table. Please give me a high level overview of what i need to do because this is fairly common scenario.
Thanks in advance :)
Basically yes. Don't think of it as a fake row. What you should do is to create an actual user account based on the data provided by Facebook API (I am not that familiar with OpenID)
Facebook API will provide you with first and last name, email address, maybe some other data
Facebook does not have the concept of login name, users login by email address.
What you do is just create a new user from the data provided by API.
There are some things to watchout for: it is possible that user is already registered on your site. When you get data from Facebook you should search your own user table to see if the email address already belongs to your own registered user and it that case you can do some fancy things like mark that user as also having a facebook login.
If I were to do that, I'd abstracted login info into a separate table and have some sort of type in the User table. The type is used to identify what auth method is used, i.e. your own, Google, etc. If a user does select using alternative methods, you do need to have association but with a different type. But yes it is a new record.

Resources