Skip to content

Commit

Permalink
Add update_password function
Browse files Browse the repository at this point in the history
  • Loading branch information
marcisme committed Jun 20, 2016
1 parent 19c5714 commit 41863c5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions marcisme/rumbl/web/models/user.ex
Expand Up @@ -11,6 +11,12 @@ defmodule Rumbl.User do
timestamps
end

def update_password(username, password) do
user = Rumbl.Repo.get_by!(__MODULE__, %{"username": username})
changeset = Rumbl.User.registration_changeset(user, %{"password": password})
Rumbl.Repo.update(changeset)
end

def changeset(model, params \\ :empty) do
model
|> cast(params, ~w(name username), [])
Expand Down

0 comments on commit 41863c5

Please sign in to comment.