Skip to content

Commit

Permalink
Provide information how to reset passphrase on mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
michalmuskala committed Mar 4, 2017
1 parent 935e5f9 commit 0da6c4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/mix/tasks/hex.ex
Expand Up @@ -144,7 +144,9 @@ defmodule Mix.Tasks.Hex do
{:ok, key} ->
key
:error ->
Mix.raise "Wrong passphrase"
Mix.raise "Wrong passphrase\n\n" <>
"If you forgot your passphrase, you can reset it using `mix hex.user reset password`" <>
" or on the hex website: https://hex.pm/password/reset"
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/mix/tasks/hex/user_test.exs
Expand Up @@ -84,7 +84,7 @@ defmodule Mix.Tasks.Hex.UserTest do
config = Hex.Config.read
assert config[:encrypted_key]

assert_raise Mix.Error, "Wrong passphrase", fn ->
assert_raise Mix.Error, ~r"^Wrong passphrase", fn ->
send self(), {:mix_shell_input, :prompt, "wrong"}
Mix.Tasks.Hex.User.run(["passphrase"])
end
Expand Down

0 comments on commit 0da6c4f

Please sign in to comment.