Fakultas Ilmu Komputer UI

Commit eef17449 authored by Muhammad Rafif Elfazri's avatar Muhammad Rafif Elfazri
Browse files

remove password in DB and add picture

parent d65d4c4e
......@@ -5,18 +5,16 @@ defmodule Diskuy.Account.User do
schema "users" do
field :username, :string
field :email, :string
field :password, :string
field :picture, :string
timestamps()
end
@doc false
def changeset(user, attrs) do
user
|> cast(attrs, [:username, :email, :password])
|> validate_required([:username, :email, :password])
|> cast(attrs, [:username, :email, :picture])
|> validate_required([:username, :email])
|> validate_format(:email, ~r/^[A-Za-z0-9._-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/)
|> validate_length(:password, min: 8)
|> unique_constraint(:username)
|> unique_constraint(:email)
end
......
......@@ -5,8 +5,7 @@ defmodule Diskuy.Repo.Migrations.CreateUsers do
create table(:users) do
add :username, :string
add :email, :string
add :password, :string
add :picture, :string
timestamps()
end
create unique_index(:users, [:username])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment