app/controllers/users/sessions_controller.rb
# Sign a user in using legacy auth information if present
Sign a user in using legacy auth information if present
Sign a user in using legacy auth information if present
def legacy_authenticate
    unless CONFIG.legacy && CONFIG.legacy.rest_auth && 
        CONFIG.legacy.rest_auth.REST_AUTH_SITE_KEY && CONFIG.legacy.rest_auth.REST_AUTH_DIGEST_STRETCHES
      return false
    end
    login = params[:login]
    password = params[:password]
    if params[:user]
      login ||= params[:user][:email] || params[:user][:login]
      password ||= params[:user][:password]
    end
    user = User.find_by_login(login)
    user ||= User.find_by_email(login)
    return false unless user
    pepper = CONFIG.legacy.rest_auth.REST_AUTH_SITE_KEY
    stretches = CONFIG.legacy.rest_auth.REST_AUTH_DIGEST_STRETCHES
    digest = Devise::Encryptable::Encryptors::RestfulAuthenticationSha1.digest(password, stretches, user.password_salt, pepper)
    if Devise.secure_compare(digest, user.encrypted_password)
      @legacy_authentication_successful = true
      user
    else
      false
    end
  end
def legacy_authenticate unless CONFIG . legacy && CONFIG . legacy . rest_auth && CONFIG . legacy . rest_auth . REST_AUTH_SITE_KEY && CONFIG . legacy . rest_auth . REST_AUTH_DIGEST_STRETCHES return false end login = params [ :login ] password = params [ :password ] if params [ :user ] login ||= params [ :user ] [ :email ] || params [ :user ] [ :login ] password ||= params [ :user ] [ :password ] end user = User . find_by_login ( login ) user ||= User . find_by_email ( login ) return false unless user pepper = CONFIG . legacy . rest_auth . REST_AUTH_SITE_KEY stretches = CONFIG . legacy . rest_auth . REST_AUTH_DIGEST_STRETCHES digest = Devise :: Encryptable :: Encryptors :: RestfulAuthenticationSha1 . digest ( password , stretches , user . password_salt , pepper ) if Devise . secure_compare ( digest , user . encrypted_password ) @legacy_authentication_successful = true user else false end end
Sign a user in using legacy auth information if present
Sign a user in using legacy auth information if present