<commit_before>class AccountController < ApplicationController

  stylesheet 'account'

  def index
    if logged_in?
      redirect_to me_url
    end
  end

  def login
    return unless request.post?
    reset_session # important!!
                  # always force a new session on every login attempt
                  # in order to prevent session fixation attacks. 
    self.current_user = User.authenticate(params[:login], params[:password])
    if logged_in?
      if params[:remember_me] == "1"
        self.current_user.remember_me
        cookies[:auth_token] = {
          :value => self.current_user.remember_token,
          :expires => self.current_user.remember_token_expires_at
        }
      end
      redirect_to params[:redirect] || {:controller => '/me/dashboard', :action => 'index'}
    else
      flash_message :title => "Could not log in"[:login_failed],
        :error => "Username or password is incorrect."[:login_failure_reason]
    end
  end<commit_msg>fixed bug which caused the anti-CSRF stuff to make it so that if you failed to login, the next attempt would aways fail even with the correct credentials.<commit_after>class AccountController < ApplicationController

  stylesheet 'account'
  skip_before_filter :verify_authenticity_token, :only => 'login'

  def index
    if logged_in?
      redirect_to me_url
    end
  end

  def login
    return unless request.post?
    reset_session # important!!
                  # always force a new session on every login attempt
                  # in order to prevent session fixation attacks. 
    self.current_user = User.authenticate(params[:login], params[:password])
    if logged_in?
      if params[:remember_me] == "1"
        self.current_user.remember_me
        cookies[:auth_token] = {
          :value => self.current_user.remember_token,
          :expires => self.current_user.remember_token_expires_at
        }
      end
      redirect_to params[:redirect] || {:controller => '/me/dashboard', :action => 'index'}
    else
      flash_message :title => "Could not log in"[:login_failed],
        :error => "Username or password is incorrect."[:login_failure_reason]
    end
  end
{'fraction_non_alphanumeric': 0.0892774965485504, 'fraction_numerical': 0.0009203865623561896, 'mean_word_length': 2.847787610619469, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1671864', 'n_tokens_mistral': 607, 'n_tokens_neox': 581, 'n_words': 174}