Sha256: fb4e76d8d1818dd05308d5f16cd6a3c8d98989d8991ac92737b8fde9d9abf9d7

Contents?: true

Size: 823 Bytes

Versions: 16

Compression:

Stored size: 823 Bytes

Contents

class UserTasks < Volt::Task
  # Login a user, takes a login and password.  Login can be either a username
  # or an e-mail based on Volt.config.public.auth.use_username
  #
  # login_info is a key with login and password (login may be e-mail)
  def login(login_info)
    login = login_info['login']
    password = login_info['password']

    query = { User.login_field => login }

    # During login we need access to the user's info even though we aren't the user
    Volt.skip_permissions do
      store._users.where(query).first.then do |user|
        fail VoltUserError, 'User could not be found' unless user

        match_pass = BCrypt::Password.new(user._hashed_password)
        fail 'Password did not match' unless  match_pass == password

        next Volt.user_login_signature(user)
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
volt-0.9.5 app/volt/tasks/user_tasks.rb
volt-0.9.5.pre12 app/volt/tasks/user_tasks.rb
volt-0.9.5.pre11 app/volt/tasks/user_tasks.rb
volt-0.9.5.pre9 app/volt/tasks/user_tasks.rb
volt-0.9.5.pre8 app/volt/tasks/user_tasks.rb
volt-0.9.5.pre7 app/volt/tasks/user_tasks.rb
volt-0.9.5.pre6 app/volt/tasks/user_tasks.rb
volt-0.9.5.pre5 app/volt/tasks/user_tasks.rb
volt-0.9.5.pre4 app/volt/tasks/user_tasks.rb
volt-0.9.5.pre3 app/volt/tasks/user_tasks.rb
volt-0.9.5.pre2 app/volt/tasks/user_tasks.rb
volt-0.9.5.pre1 app/volt/tasks/user_tasks.rb
volt-0.9.4 app/volt/tasks/user_tasks.rb
volt-0.9.4.pre5 app/volt/tasks/user_tasks.rb
volt-0.9.4.pre3 app/volt/tasks/user_tasks.rb
volt-0.9.4.pre2 app/volt/tasks/user_tasks.rb