Password hashing and Ecto associations for StatWatch

In this episode we continue migrating StatWatch from being a purely back-end OTP app into a Phoenix 1.3 project.

We'll install Comeonin and Bcrypt (and cover how to get them to build properly on Windows), so we can hash user passwords before storing them in the database.

Next, we'll associate profiles with users and make it possible for them to create project profiles right from their user pages. In the process, we'll also have to fix the data created before we were storing these associations and hashed passwords.

Following that, we'll create a plug to restrict various parts of the site to logged in users. Some parts will be restricted to the specific user they concern and we'll start rendering customized pages based on who is logged in. This video includes quite a bit of debugging, so setting up profile page URLs to use slugs instead of IDs will be in the following video. So will the plug to conveniently restrict actions to admin users.


UPDATE:

If you're using VS 2017 C++ build tools and still having difficulties with Comeonin and Bcrypt, open up your VS developer command prompt and go to .\VC\Auxiliary\Build, where you can find vcvarsall.bat and run it with the amd64 option. The full path and command will look something like this:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat amd64

After running the above command, navigate to your project and run mix deps.compile.

If you're using VS2015 C++ build tools, vcvarsall.bat will be as I showed in the video (depending on your version): C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat amd64

Update 2:

Comeonin has greatly improved its error message and it now includes a suggested path and command to run your vcvarsall.bat. It's slow going, but things are beginning to get a bit less difficult for Windows users to learn Elixir!

Back to index

No Comments