<commit_before>#*********************************************
# For the ConsiderIt project.
# Copyright (C) 2010 - 2012 by <NAME>.
# Licensed under the AGPL for non-commercial use.
# See https://github.com/tkriplean/ConsiderIt/ for details.
#*********************************************

require 'mail'

class UserMailer < ActionMailer::Base
  ActionMailer::Base.delivery_method = :mailhopper  
  layout 'email'
  include Devise::Mailers::Helpers



  ######### DEVISE MAILERS
  def confirmation_instructions(user, proposal, options)
    generate_reset_password_token!(user) #if (user.reset_password_token.nil? || !user.reset_password_period_valid?)

    @user = user
    @proposal = proposal
    @host = options[:host]
    @options = options
    email_with_name = "#{@user.username} <#{@user.email}>"

    subject = "please confirm your email"
    from = format_email(options[:from], options[:app_title])
    mail(:from => from, :to => email_with_name, :subject => "[#{options[:app_title]}] #{subject}")

  end

  def reset_password_instructions(user, options)
    generate_reset_password_token!(user) #if (user.reset_password_token.nil? || !user.reset_password_period_valid?)
    @user = user
    @host = options[:host]
    @options = options
    email_with_name = "#{@user.username} <#{@user.email}>"
    subject = "password reset instructions"
    from = format_email(options[:from], options[:app_title])
    mail(:from => from, :to => email_with_name, :subject => "[#{options[:app_title]}] #{subject}")
  end

  private

    def format_email(addr, name = nil)
      address = Mail::Address.new addr # ex: "<EMAIL>"
      if name
        address.display_name = name # ex: "<NAME>"
      end
      # Set the From or Reply-To header to the following:
      address.format # returns "<NAME> <<EMAIL>>"

    end

    def generate_reset_password_token!(user)
      user.reset_password_token = User.reset_password_token
      user.reset_password_sent_at = Time.now.utc
      user.save
    end
end
<commit_msg>"fixing" odd validation problem<commit_after>#*********************************************
# For the ConsiderIt project.
# Copyright (C) 2010 - 2012 by <NAME>.
# Licensed under the AGPL for non-commercial use.
# See https://github.com/tkriplean/ConsiderIt/ for details.
#*********************************************

require 'mail'

class UserMailer < ActionMailer::Base
  ActionMailer::Base.delivery_method = :mailhopper  
  layout 'email'
  include Devise::Mailers::Helpers



  ######### DEVISE MAILERS
  def confirmation_instructions(user, proposal, options)
    generate_reset_password_token!(user) #if (user.reset_password_token.nil? || !user.reset_password_period_valid?)

    @user = user
    @proposal = proposal
    @host = options[:host]
    @options = options
    email_with_name = "#{@user.username} <#{<EMAIL>}>"

    subject = "please confirm your email"
    from = format_email(options[:from], options[:app_title])
    mail(:from => from, :to => email_with_name, :subject => "[#{options[:app_title]}] #{subject}")

  end

  def reset_password_instructions(user, options)
    generate_reset_password_token!(user) #if (user.reset_password_token.nil? || !user.reset_password_period_valid?)
    @user = user
    @host = options[:host]
    @options = options
    email_with_name = "#{@user.username} <#{<EMAIL>}>"
    subject = "password reset instructions"
    from = format_email(options[:from], options[:app_title])
    mail(:from => from, :to => email_with_name, :subject => "[#{options[:app_title]}] #{subject}")
  end

  private

    def format_email(addr, name = nil)
      address = Mail::Address.new addr # ex: "<EMAIL>"
      if name
        address.display_name = name # ex: "<NAME>"
      end
      # Set the From or Reply-To header to the following:
      address.format # returns "<NAME> <<EMAIL>>"

    end

    def generate_reset_password_token!(user)
      user.reset_password_token = <PASSWORD>token
      user.reset_password_sent_at = Time.now.utc
      pp user
      pp user.save(:validate => false)
      pp user
    end
end

{'fraction_non_alphanumeric': 0.17408409146791246, 'fraction_numerical': 0.003934103761986722, 'mean_word_length': 4.136363636363637, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 35, 'https://': 2, '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': '5687542', 'n_tokens_mistral': 1274, 'n_tokens_neox': 1233, 'n_words': 291}