We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9bb6e3f commit e7440a9Copy full SHA for e7440a9
app/webapp/ruby/lib/torb/web.rb
@@ -3,6 +3,7 @@
3
require 'erubi'
4
require 'mysql2'
5
require 'mysql2-cs-bind'
6
+require 'openssl'
7
8
module Torb
9
class Web < Sinatra::Base
@@ -272,7 +273,7 @@ def render_report_csv(reports)
272
273
password = body_params['password']
274
275
user = db.xquery('SELECT * FROM users WHERE login_name = ?', login_name).first
- pass_hash = db.xquery('SELECT SHA2(?, 256) AS pass_hash', password).first['pass_hash']
276
+ pass_hash = OpenSSL::Digest::SHA256.hexdigest(password)
277
halt_with_error 401, 'authentication_failed' if user.nil? || pass_hash != user['pass_hash']
278
279
session['user_id'] = user['id']
0 commit comments