Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Jackie Jen
2,723 Pointshow to allow multiple users login to webpage under same login username and password?
right now i have a simple login page that required to key in username and password. how was the idea to have multiple users login under one account. Each account represent a company
if any update or changes, that particular account will only be changes and will not affect other.
any ideas on doing that?
1 Answer
Richard Duncan
5,568 PointsHi Kenny,
I've had a stab at this based on my understanding of your question. Here goes, this just sounds to me like a standard user/pass setup the only difference being that multiple users have access to the same login details.
You would be better off allowing users to sign up and select the company they work for to give greater security to everyone.
Typically a process would be;
Sign up > user inputted data is validated, email is checked to match a pattern such as text@domain.tla > "salt" is added to their password then hashed using an algorithm such as SHA or MD5.
Data store > The user details are stored in your database, the program should store the hashed password and not the plain text version (as a minimum security feature) you may also want to hash and store the username & email as well so that if anyone does gain access to your database it is all encrypted.
Validate > send an email to the users email account to validate their email, as mentioned above your first step validation process is only checking that they have entered a string of text that validates to your pattern.
Login > The user enters the plain text login details, your application add's salt to the necessary fields, hashes then queries the db to see if the details match the values stored, if they do then they have authenticated (logged in) if not throw an error such as bad password.
Edit/Make changes > Because now everyone who has signed up is validated and have their own individual accounts, changes made via your edit area will only affect that login.