Class: AuthRepository
- Inherits:
-
Ibrain::BaseRepository
- Object
- Ibrain::BaseRepository
- AuthRepository
- Defined in:
- app/repositories/auth_repository.rb
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(record, params) ⇒ AuthRepository
constructor
A new instance of AuthRepository.
- #sign_in ⇒ Object
Constructor Details
#initialize(record, params) ⇒ AuthRepository
Returns a new instance of AuthRepository.
6 7 8 9 10 11 |
# File 'app/repositories/auth_repository.rb', line 6 def initialize(record, params) super(nil, record) @params = params @collection = Ibrain.user_class end |
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/repositories/auth_repository.rb', line 13 def create user = collection.new(provider: 'manual') user.assign_attributes(normalize_params.except(:id_token)) user.save! user end |
#sign_in ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/repositories/auth_repository.rb', line 21 def sign_in return firebase_verify if user = collection.ibrain_find(manual_params, available_columns) return unless user.try(:valid_password?, manual_params[:password]) user end |