Class: Sprangular::PasswordsController
Instance Method Summary
collapse
#invalid_resource!, #not_found, #unauthorized
Instance Method Details
#create ⇒ Object
3
4
5
6
7
8
9
|
# File 'app/controllers/sprangular/passwords_controller.rb', line 3
def create
user = Spree::User.find_by!(email: params[:spree_user][:email])
Spree::User.send_reset_password_instructions(user)
respond_with user
end
|
#update ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'app/controllers/sprangular/passwords_controller.rb', line 11
def update
if params[:spree_user][:password].blank?
user = Spree::User.new
user.errors[:password] = "Cannot be blank"
else
user = Spree::User.reset_password_by_token(params[:spree_user])
if user.errors.empty?
sign_in :spree_user, user
end
end
respond_with user
end
|