<commit_before># -*- encoding : utf-8 -*-
class UsersController < ApplicationController
  skip_before_filter :login_required, :except => [:destroy, :edit]
  menu_group "設定"
  menu "プロフィール", :only => [:edit, :update]

  before_filter :password_token_required, :only => [:edit_password, :update_password]
#  layout 'login'
  cache_sweeper :export_sweeper, :only => [:destroy]

  # render new.rhtml
  def new
    @title = "ユーザー登録"
    @personal_info_policy_setting = PersonalInfoPolicySetting.new
  end

  def create
    @title = "ユーザー登録"
    cookies.delete :auth_token
    # protects against session fixation attacks, wreaks havoc with 
    # request forgery protection.
    # uncomment at your own risk
    # reset_session
    @user = User.new(params[:user])
    @user.save
    if !@user.errors.empty?
      render :action => 'new'
    elsif defined?(SKIP_MAIL) && SKIP_MAIL
      do_activate(@user.activation_code)
    end
  end

  def activate
    do_activate(params[:activation_code])
  end
  
  def activate_login_engine
    do_activate(params[:key])
  end

  # パスワード忘れの際、Emailを入力させるフォームを表示する
  # 内部的には change_password_token を生成し、そのコード付きでアクセスできるパスワード設定画面に誘導する
  # tokenの期限はchange_password_expires_at
  def forgot_password
    @title = "パスワードを忘れたとき"
  end
  
  def deliver_password_notification
    @title = "パスワードを忘れたとき"
    raise InvalidParameterError if params[:email].blank?
    
    user =  User.find_by_email(params[:email])
    unless user
      flash[:error] = "該当するユーザーは登録されていません。"
      render :action => 'forgot_password'<commit_msg>Fix to set personal info policy setting valiable when user/create failed.<commit_after># -*- encoding : utf-8 -*-
class UsersController < ApplicationController
  skip_before_filter :login_required, :except => [:destroy, :edit]
  menu_group "設定"
  menu "プロフィール", :only => [:edit, :update]

  before_filter :password_token_required, :only => [:edit_password, :update_password]
#  layout 'login'
  cache_sweeper :export_sweeper, :only => [:destroy]

  # render new.rhtml
  def new
    @title = "ユーザー登録"
    @personal_info_policy_setting = PersonalInfoPolicySetting.new
  end

  def create
    @title = "ユーザー登録"
    cookies.delete :auth_token
    # protects against session fixation attacks, wreaks havoc with 
    # request forgery protection.
    # uncomment at your own risk
    # reset_session
    @user = User.new(params[:user])
    @user.save
    if !@user.errors.empty?
      @personal_info_policy_setting = PersonalInfoPolicySetting.new
      render :action => 'new'
    elsif defined?(SKIP_MAIL) && SKIP_MAIL
      do_activate(@user.activation_code)
    end
  end

  def activate
    do_activate(params[:activation_code])
  end
  
  def activate_login_engine
    do_activate(params[:key])
  end

  # パスワード忘れの際、Emailを入力させるフォームを表示する
  # 内部的には change_password_token を生成し、そのコード付きでアクセスできるパスワード設定画面に誘導する
  # tokenの期限はchange_password_expires_at
  def forgot_password
    @title = "パスワードを忘れたとき"
  end
  
  def deliver_password_notification
    @title = "パスワードを忘れたとき"
    raise InvalidParameterError if params[:email].blank?
    
    user =  User.find_by_email(params[:email])
    unless user
      flash[:error] = "該当するユーザーは登録されていません。"
      render :action => 'forgot_password'
{'fraction_non_alphanumeric': 0.09720496894409938, 'fraction_numerical': 0.0006211180124223603, 'mean_word_length': 3.9175572519083968, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '5648888', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1216, 'n_words': 231}