解决注册激活页面刷新404的问题

This commit is contained in:
huang 2016-12-29 14:38:51 +08:00
parent f733e2a276
commit b57384778e
2 changed files with 22 additions and 6 deletions

View File

@ -144,8 +144,9 @@ class AccountController < ApplicationController
when '1' when '1'
#register_by_email_activation(@user) #register_by_email_activation(@user)
unless @user.new_record? unless @user.new_record?
flash[:notice] = l(:notice_account_register_done) redirect_to account_email_valid_path(:mail => @user.mail, :user_id => @user.id)
render action: 'email_valid', locals: {:mail => @user.mail} # flash[:notice] = l(:notice_account_register_done)
# render action: 'email_valid', locals: {:mail => @user.mail}
end end
when '3' when '3'
#register_automatically(@user) #register_automatically(@user)
@ -244,6 +245,12 @@ class AccountController < ApplicationController
end end
def email_valid def email_valid
begin
@mail_type = params[:mail].split("@")[1]
@user = User.find(params[:user_id])
rescue
return render_404
end
respond_to do |format| respond_to do |format|
format.html { render :layout => "base_mail"} format.html { render :layout => "base_mail"}
format.js format.js

View File

@ -19,13 +19,11 @@ class ForumsController < ApplicationController
#@memo.forum_id = "1" #@memo.forum_id = "1"
#@memo.author_id = User.current.id #@memo.author_id = User.current.id
#@forum = @memo.forum #@forum = @memo.forum
@type = params[:type]
cs = CommentService.new cs = CommentService.new
@memo,message = cs.create_feedback params,User.current @memo,message = cs.create_feedback params,User.current
respond_to do |format| respond_to do |format|
if !@memo.new_record? if !@memo.new_record?
format.html { redirect_to forum_path(@memo.forum) } format.html { redirect_to forum_path(@memo.forum) }
format.js
else else
sort_init 'updated_at', 'desc' sort_init 'updated_at', 'desc'
sort_update 'created_at' => "#{Memo.table_name}.created_at", sort_update 'created_at' => "#{Memo.table_name}.created_at",
@ -51,8 +49,19 @@ class ForumsController < ApplicationController
end end
else else
respond_to do |format| respond_to do |format|
format.html { redirect_to signin_path } format.html { redirect_to signin_path }
end end
end
end
def mail_feedback
@user = User.where(:id => params[:user_id]).first
unless @user.nil?
cs = CommentService.new
@memo, message = cs.create_feedback params, @user
end
respond_to do |format|
format.js
end end
end end