From 843811cf99915ce7ad6d3afac2fb54a50f2e564c Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 3 Dec 2014 11:16:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=9B=E5=BB=BA=E4=BA=8E?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E7=94=A8=E6=88=B7=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 279e89f13..70a1f340b 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -177,6 +177,38 @@ class AccountController < ApplicationController end end + def create_and_save_user login,password,email + @user = User.new + @user.admin = false + @user.register + @user.login = login + @user.mail = email + unless password.blank? + @user.password = password + end + case Setting.self_registration + when '1' + register_by_email_activation(@user) + when '3' + register_automatically(@user) + else + register_manually_by_administrator(@user) + end + if @user.id != nil + ue = @user.user_extensions ||= UserExtensions.new + #ue = UserExtensions.create(:identity => params[:identity].to_i,:technical_title => params[:technical_title], :gender => params[:gender].to_i, :user_id => @user.id, :student_id => ) + #ue.identity = params[:identity].to_i + #ue.technical_title = params[:technical_title] + #ue.gender = params[:gender].to_i + ue.user_id = @user.id + #ue.student_id = params[:no] + #ue.location = params[:province] if params[:province] != nil + #ue.location_city = params[:city] if params[:city] != nil + ue.save + end + @user + end + # Token based account activation def activate (redirect_to(home_url); return) unless Setting.self_registration? && params[:token].present?