Sha256: 91f3259be1e2d3ab3cad6c139e8b97c69a546c76d2942cf1df32998dbe8f553a
Contents?: true
Size: 721 Bytes
Versions: 1
Compression:
Stored size: 721 Bytes
Contents
module Spree module Api module V1 class UsersController < Spree::Api::V1::BaseController before_filter :check_for_api_key, :except => [:sign_up, :sign_in] def sign_up @user = Spree::User.new(params[:user]) if !@user.save unauthorized return end @user.generate_spree_api_key! end def sign_in @user = Spree::User.find_by_email(params[:user][:email]) if !@user.present? || !@user.valid_password?(params[:user][:password]) unauthorized return end @user.generate_spree_api_key! if @user.spree_api_key.blank? end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spree_api_auth-0.2.0 | app/controllers/spree/api/v1/users_controller.rb |