diff --git a/app/api/mobile/apis/new_comment.rb b/app/api/mobile/apis/new_comment.rb index 02411c080..872225e47 100644 --- a/app/api/mobile/apis/new_comment.rb +++ b/app/api/mobile/apis/new_comment.rb @@ -56,9 +56,10 @@ module Mobile user = us.register ({:login=>openid, :mail=>"#{openid}@163.com", :password=>"12345678", :password_confirmation=>"12345678", :should_confirmation_password => true}) - user.update_attributes(:lastname=>name) - raise user.errors.full_messages.first if user.new_record? + user.update_attributes(:lastname=>name) + #自动激活 + user = automatically_register(user) UserWechat.create!( openid: openid, user: user, diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index 62376dc6e..08f037588 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -2,6 +2,7 @@ module Mobile module Apis class Users < Grape::API + include AccountHelper resource :users do desc "查询是否已绑定" @@ -68,6 +69,8 @@ module Mobile user = us.register params.merge(:password_confirmation => params[:password], :should_confirmation_password => true) raise user.errors.full_messages.first if user.new_record? + #自动激活 + user = automatically_register(user) if uw && !uw.real? user.update_attributes(:lastname=>uw.user[:lastname])