微信注册自动激活
This commit is contained in:
parent
94777a42c4
commit
6eca6253db
|
@ -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,
|
||||
|
|
|
@ -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])
|
||||
|
|
Loading…
Reference in New Issue