11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'app/graphql/ibrain/mutations/sign_up_mutation.rb', line 11
def resolve(_args)
return graphql_returning(false, false) if auth_resource.blank?
sign_in(resource_name, auth_resource)
@current_user = warden.authenticate!(auth_options)
warden.set_user(current_user)
current_user.jwt_token, jti = (request, auth_resource)
current_user.jti = jti
current_user.save!
if params[:device_token].present?
device_token = current_user.device_tokens.find_by(token: params[:device_token])
current_user.device_tokens.create!({ token: params[:device_token] }) if device_token.blank?
end
context[:current_user] = current_user
graphql_returning
end
|