class SessionsController < ApplicationController
  def callback
    user = User.omniauth(env['omniauth.auth'])
    user.update metadata: Mumukit::Auth::Token.from_env(env).metadata

    remember_me_token.value = user.remember_me_token
    redirect_after_login
  end

  def failure
    @error_msg = request.params['message']
  end

  def destroy
    remember_me_token.clear!
    redirect_to root_url
  end


  def redirect_after_login
    path = session[:redirect_after_login] || :back
    session[:redirect_after_login] = nil

    redirect_to path
  end
end

class SessionsController < ApplicationController
  def callback
    user = User.omniauth(env['omniauth.auth'])
    user.update! metadata: Mumukit::Auth::Token.from_env(env).metadata

    remember_me_token.value = user.remember_me_token
    redirect_after_login
  end

  def failure
    @error_msg = request.params['message']
  end

  def destroy
    remember_me_token.clear!
    redirect_to root_url
  end


  def redirect_after_login
    path = session[:redirect_after_login] || :back
    session[:redirect_after_login] = nil

    redirect_to path
  end
end

Update must not fail silently
Update must not fail silently
