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

General Discussion

Alec Plummer
Alec Plummer
15,181 Points

Creating user login and storing user data to server?

When creating a web app, how would I go about setting up a user login so people can save their preferences? Are there any courses on teamtreehouse that explain this process?

Example. Say I create a color tool to help designers/developers select color palettes to use, I want to create a way for the user to login and save color palettes they've created for future use. It doesn't have to be anything complicated, just a basic login/pass with the ability to retrieve user preferences (in this case, saved color palettes).

Any help with pointing me in the general direction will be greatly appreciated, thanks.

1 Answer

Kevin Korte
Kevin Korte
28,148 Points

The login system would be your standard login in system. If they wanted to save a color pallet, I'd have another table to save color pallet info. You could potentially just store and array of the hex values for the colors in the database, and associate that pallet to the current user logged in, using a primary key/foreign key.

So to retrieve you just would have to read the hex values back out, and parse them back into representations of the color.

Alec Plummer
Alec Plummer
15,181 Points

Thanks for the help, I'll give this a try!