alfa 0.0.7.pre → 0.0.8.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 135f4d850e0a5f9d909bfbd6fcf716c08c44619a
4
- data.tar.gz: 1c49574ec9d31e98d33622304694c3d0935ff9d5
3
+ metadata.gz: bf1179ccb34605f73a030a136f3286815a34ea09
4
+ data.tar.gz: 468298b0cc1e9fcbcc32a6dcf05cd563daf70b9f
5
5
  SHA512:
6
- metadata.gz: 3d6dba8c6f5f3970313d9f222630f38675554f9164287c33a97957ab713da7fac5c72a4fb29dae0341ea38f577bc6ad3867ca249eabec973cde54a62ee25f1c4
7
- data.tar.gz: 17786702229e4212107ec51232513f04d9726c7d945999b422bb65704a06e7c2372f0d221388cc103a5a03cfb8247f00127c07f0dba89ecffaeecf4db47eb7ab
6
+ metadata.gz: e091ba4bf37eb02d49d959ec12c455799399ee6f69f30af7f1d01afce52a88bb8af9c5ee50bc82bd0de07954da52d2fccf53a165b48eeb85b7d3a48332235daa
7
+ data.tar.gz: a74f9db275082b9ddfc398efc38c06677cce1eb441f5628d5e1e4e0b221684180e348a8d117dcc0f9710df19593ca98e05e1de1091da5d662a64a3feaf04760d
@@ -8,8 +8,7 @@ Sequel.migration do
8
8
  create_table :users do
9
9
  primary_key :id
10
10
  column :login, String, null: false
11
- column :salt, String, fixed: true, size: 10, null: false
12
- column :passhash, String, fixed: true, size: 60, null: false
11
+ column :passhash, String, text: true, null: false
13
12
  column :groups, String, text: true
14
13
  column :email, String
15
14
  column :first_name, String, size: 100
@@ -2,7 +2,7 @@ require 'alfa/logger'
2
2
  require 'alfa/config'
3
3
  require 'alfa/exceptions'
4
4
  require 'alfa/user'
5
- require 'bcrypt'
5
+ require 'scrypt'
6
6
 
7
7
  Encoding.default_external = 'utf-8'
8
8
  Encoding.default_internal = 'utf-8'
@@ -65,8 +65,8 @@ module Alfa
65
65
  unless User.first(:login=>login)
66
66
  @logger.portion do |l|
67
67
  salt = SecureRandom.hex(5)
68
- passhash = BCrypt::Password.create("#{salt}#{password}")
69
- User.create(:login=>login, :salt=>salt, :passhash=>passhash)
68
+ passhash = SCrypt::Password.create(password)
69
+ User.create(:login=>login, :passhash=>passhash)
70
70
  l.info("created new user login=#{login}, password=***, salt=#{salt}, passhash=#{passhash}")
71
71
  end
72
72
  return true, "Registration done"
@@ -1,5 +1,5 @@
1
1
  require 'securerandom'
2
- require 'bcrypt'
2
+ require 'scrypt'
3
3
 
4
4
  module Alfa
5
5
  class << self
@@ -83,12 +83,11 @@ module Alfa
83
83
  # end
84
84
  module UserModule
85
85
  def password=(p)
86
- self.salt = SecureRandom.hex(5)
87
- self.passhash = BCrypt::Password.create("#{self.salt}#{p}")
86
+ self.passhash = SCrypt::Password.create(p)
88
87
  end
89
88
 
90
89
  def password_valid?(p)
91
- BCrypt::Password.new(self.passhash) == "#{self.salt}#{p}"
90
+ SCrypt::Password.new(self.passhash) == p
92
91
  end
93
92
 
94
93
  def groups=(g)
@@ -80,7 +80,7 @@ module Alfa
80
80
  def try_login(login, password)
81
81
  u = @application.config[:db][:main][:instance][:users].first(login: login)
82
82
  raise "No such login: #{login}" unless u
83
- if BCrypt::Password.new(u[:passhash]) == "#{u[:salt]}#{password}"
83
+ if SCrypt::Password.new(u[:passhash]) == password
84
84
  # success
85
85
  session[:user_id] = u[:id]
86
86
  session[:passhash] = u[:passhash]
data/version.rb CHANGED
@@ -1 +1 @@
1
- ALFA_VERSION = '0.0.7.pre'
1
+ ALFA_VERSION = '0.0.8.pre'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alfa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7.pre
4
+ version: 0.0.8.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valentin Syrovatskiy
@@ -173,25 +173,25 @@ dependencies:
173
173
  - !ruby/object:Gem::Version
174
174
  version: 0.3.1
175
175
  - !ruby/object:Gem::Dependency
176
- name: bcrypt
176
+ name: scrypt
177
177
  requirement: !ruby/object:Gem::Requirement
178
178
  requirements:
179
179
  - - "~>"
180
180
  - !ruby/object:Gem::Version
181
- version: '3.1'
181
+ version: '1.2'
182
182
  - - ">="
183
183
  - !ruby/object:Gem::Version
184
- version: 3.1.7
184
+ version: 1.2.1
185
185
  type: :runtime
186
186
  prerelease: false
187
187
  version_requirements: !ruby/object:Gem::Requirement
188
188
  requirements:
189
189
  - - "~>"
190
190
  - !ruby/object:Gem::Version
191
- version: '3.1'
191
+ version: '1.2'
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
- version: 3.1.7
194
+ version: 1.2.1
195
195
  description: ''
196
196
  email: vsyrovat@gmail.com
197
197
  executables: