Class: UserAuthenticationsController

Inherits:
Spree::BaseController
  • Object
show all
Defined in:
app/controllers/user_authentications_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



20
21
22
23
24
25
26
27
28
# File 'app/controllers/user_authentications_controller.rb', line 20

def destroy
  @auth = current_user.user_authentications.find(params[:id])

  authorize! :destroy, @auth

  @auth.destroy
  flash[:notice] = "Successfully deleted authentication source."
  redirect_to 
end

#updateObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/user_authentications_controller.rb', line 3

def update
  @user = User.find(params[:id])

  authorize! :edit, @user, session[:user_access_token]

  session[:user_access_token] = nil

  @user.email = params[:user][:email]
  if @user.save
    (@user, :event => :authentication) unless current_user
    redirect_back_or_default(products_path)
  else
    flash.now[:error] = "There is already an account with that email. Please sign in to associate these accounts."
    render(:template => 'users/merge')
  end
end