hassin23ayz / phx_auth

Understanding phx gen authentication by doing a small project ref: https://levelup.gitconnected.com/a-deep-dive-into-authentication-in-elixir-phoenix-with-phx-gen-auth-9686afecf8bd

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PhxAuth

ayex@HP:~/projects$ mix phx.new phx_auth

$ mix deps.get $ mix deps.compile

context: Accounts schema : User Table : users

$ mix phx.gen.auth Accounts User users $ mix deps.get

$ sudo -u postgres psql postgres=# create user phx_auth with encrypted password 'auth_phx'; postgres=# ALTER ROLE phx_auth CREATEDB; postgres=# ALTER ROLE phx_auth LOGIN; postgres=# ALTER ROLE phx_auth SUPERUSER;

config/dev.exs : change password of DB

$ mix ecto.create $ mix ecto.migrate

$ iex -S mix phx.server

register an user

after login -> One browser = One user : 2 users cannot be present in the same browser

the password inputted by user is not persisted in DB. The Hash(by-bycrypt) of the password gets persisted

About

Understanding phx gen authentication by doing a small project ref: https://levelup.gitconnected.com/a-deep-dive-into-authentication-in-elixir-phoenix-with-phx-gen-auth-9686afecf8bd


Languages

Language:Elixir 84.1%Language:CSS 8.7%Language:HTML 6.0%Language:JavaScript 1.2%