Skip to content

Instantly share code, notes, and snippets.

@tsloughter
Created July 16, 2011 00:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsloughter/1085856 to your computer and use it in GitHub Desktop.
Save tsloughter/1085856 to your computer and use it in GitHub Desktop.
-spec is_valid(binary(), binary()) -> true | false.
is_valid(Username, Password) ->
case ct_model_users:find([{username, Username}]) of
not_found ->
false;
User ->
UserPassword = ct_model_users:get(password, User),
UserPassword =:= bcrypt:hashpw(Password, UserPassword)
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment