Skip to content

Commit 5e05a9d

Browse files
committed
Remove account password reset command
1 parent 1b812ed commit 5e05a9d

3 files changed

Lines changed: 0 additions & 42 deletions

File tree

lib/hex/api/user.ex

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,4 @@ defmodule Hex.API.User do
2323
to_string(email)
2424
)
2525
end
26-
27-
def password_reset(name) do
28-
config = Client.config()
29-
:mix_hex_api_user.reset_password(config, to_string(name))
30-
end
3126
end

lib/mix/tasks/hex.user.ex

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,6 @@ defmodule Mix.Tasks.Hex.User do
7575
7676
$ mix hex.user key list
7777
78-
## Reset user account password
79-
80-
Starts the process for resetting account password.
81-
82-
$ mix hex.user reset_password account
83-
8478
## Reset local password
8579
8680
Updates the local password for your local authentication credentials.
@@ -125,9 +119,6 @@ defmodule Mix.Tasks.Hex.User do
125119
["key", "list"] ->
126120
key_list()
127121

128-
["reset_password", "account"] ->
129-
reset_account_password()
130-
131122
["reset_password", "local"] ->
132123
reset_local_password()
133124

@@ -147,7 +138,6 @@ defmodule Mix.Tasks.Hex.User do
147138
{"key revoke KEY_NAME", "Removes given key from account"},
148139
{"key revoke --all", "Revoke all keys"},
149140
{"key list", "Lists all keys associated with your account"},
150-
{"reset_password account", "Reset user account password"},
151141
{"reset_password local", "Reset local password"}
152142
]
153143
end
@@ -164,7 +154,6 @@ defmodule Mix.Tasks.Hex.User do
164154
mix hex.user key revoke KEY_NAME
165155
mix hex.user key revoke --all
166156
mix hex.user key list
167-
mix hex.user reset_password account
168157
mix hex.user reset_password local
169158
""")
170159
end
@@ -182,23 +171,6 @@ defmodule Mix.Tasks.Hex.User do
182171
end
183172
end
184173

185-
defp reset_account_password() do
186-
name = Hex.Shell.prompt("Username or Email:") |> String.trim()
187-
188-
case Hex.API.User.password_reset(name) do
189-
{:ok, {code, _, _}} when code in 200..299 ->
190-
Hex.Shell.info(
191-
"We’ve sent you an email containing a link that will allow you to reset " <>
192-
"your account password for the next 24 hours. Please check your spam folder if the " <>
193-
"email doesn’t appear within a few minutes."
194-
)
195-
196-
other ->
197-
Hex.Shell.error("Initiating password reset for #{name} failed")
198-
Hex.Utils.print_error_result(other)
199-
end
200-
end
201-
202174
defp reset_local_password() do
203175
encrypted_key = Hex.State.fetch!(:api_key_write)
204176
read_key = Hex.State.fetch!(:api_key_read)

test/mix/tasks/hex.user_test.exs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -206,15 +206,6 @@ defmodule Mix.Tasks.Hex.UserTest do
206206
end)
207207
end
208208

209-
test "reset account password" do
210-
Hexpm.new_user("reset_password", "reset_password@mail.com", "password", "reset_password")
211-
212-
send(self(), {:mix_shell_input, :prompt, "reset_password"})
213-
Mix.Tasks.Hex.User.run(["reset_password", "account"])
214-
215-
assert_received {:mix_shell, :info, ["We’ve sent you an email" <> _]}
216-
end
217-
218209
test "reset local password" do
219210
in_tmp(fn ->
220211
set_home_cwd()

0 commit comments

Comments
 (0)