Skip to content

Commit

Permalink
#1194 fixed and tested
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jan 22, 2024
1 parent 45656a4 commit 9fd90d7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ GEM
racc (~> 1.4)
openssl (3.2.0)
parallel (1.24.0)
parser (3.3.0.4)
parser (3.3.0.5)
ast (~> 2.4.1)
racc
pg (1.5.4)
Expand Down
7 changes: 3 additions & 4 deletions front/front_login.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@
get '/github-callback' do
code = params[:code]
error(400) if code.nil?
login = settings.glogin.user(code)[:login]
identity = login
humans.create(identity) unless humans.github?(login)
json = settings.glogin.user(code)
identity = json['login']
cookies[:identity] = GLogin::Cookie::Open.new(
identity,
{ id: identity },
settings.config['github']['encryption_secret'],
context
).to_s
Expand Down
2 changes: 1 addition & 1 deletion netbout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
config = {
'github' => {
'client_id' => '?',
'client_secret' => '?',
'client_secret' => '',
'encryption_secret' => ''
},
'sentry' => ''
Expand Down
5 changes: 5 additions & 0 deletions test/test_netbout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ def test_flag_message
assert_equal(name, json['flags'][0]['name'])
end

def test_github_callback
get('/github-callback?code=99999')
assert_equal(302, last_response.status, last_response.body)
end

private

def login(name = test_name)
Expand Down

0 comments on commit 9fd90d7

Please sign in to comment.