You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: sessions_controller.rb
    path of file: ./repos/doctor/app/controllers
    
    the code of the file until where you have to start completion: #
 # Doctor, (C) 2016 Minio, Inc.
 #
 # Licensed under the 
    
  def create
    user = User.find_by_email(params[:email])
    if user && user.authenticate(params[:password])
      session[:user_id] = user.id
       if current_user.admin
         mixpanel.track("Sign In", "ID"          => current_user.id,
                                    "Email"       => current_user.email) 
                                    
        redirect_to dashboard_path, info: "Welcome back admin!"
       else 
        redirect_to hub_index_path, warning: "Not Authorized!"
       end