80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# File 'lib/wepredict/cli/user.rb', line 80
def forgotten_password(email)
begin
WePredict::User.forgotten_password(:email => email)
rescue WePredict::Errors::BadRequest
say "We can't find you! Maybe you want to signup instead?", :red
exit
end
say "We have sent you a super secret code to your email, go check your email and then enter the code here!"
begin
code = ask "Super secret code:"
password = capture_password(true)
WePredict::User.reset_forgotten_password(:email => email, :forgotten_password_code => code, :new_password => password)
rescue WePredict::Errors::AccessDenied
say "That's not the right super secret code! Try again", :red
retry
end
say "Sucessfully reset your password", :green
end
|