module UserAuth::Web::Helpers

Public Instance Methods

build_jwt(data) click to toggle source
# File lib/user_auth/web/helpers.rb, line 33
def build_jwt(data)
  exp = Time.now.to_i + UserAuth.configuration.jwt_exp
  Token.new.create(data.merge(exp: exp))
end
current_user() click to toggle source
# File lib/user_auth/web/helpers.rb, line 8
def current_user
  @current_user ||= UserAuth::Models::User.with_pk!(warden.user.user_id)
end
deliver_email(options) click to toggle source
# File lib/user_auth/web/helpers.rb, line 16
def deliver_email(options)
  UserAuth.configuration.deliver_mail.call(options)
end
json(data) click to toggle source
# File lib/user_auth/web/helpers.rb, line 20
def json(data)
  content_type(:json)
  JSON.dump(data)
end
json_user_token(user) click to toggle source
# File lib/user_auth/web/helpers.rb, line 25
def json_user_token(user)
  json(
    token_type: "Bearer",
    token: build_jwt(user.to_json),
    refresh_token: user.refresh_token!
  )
end
params() click to toggle source
Calls superclass method
# File lib/user_auth/web/helpers.rb, line 12
def params
  super.symbolize_keys.with_indifferent_access
end
warden() click to toggle source
# File lib/user_auth/web/helpers.rb, line 4
def warden
  env["warden"]
end