Skip to content

Commit

Permalink
[CP] Bug fixes (aptos-labs#980)
Browse files Browse the repository at this point in the history
  • Loading branch information
CapCap authored May 13, 2022
1 parent a199144 commit 4a383a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion ecosystem/platform/server/app/models/it1_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class It1Profile < ApplicationRecord
validates :validator_metrics_port, presence: true, numericality: { only_integer: true }

validates :fullnode_port, numericality: { only_integer: true }, allow_nil: true
validates :fullnode_network_key, uniqueness: true, format: { with: /\A0x[a-f0-9]{64}\z/i }
validates :fullnode_network_key, uniqueness: true, format: { with: /\A0x[a-f0-9]{64}\z/i }, allow_nil: true,
allow_blank: true

validates :terms_accepted, acceptance: true

Expand Down
12 changes: 6 additions & 6 deletions ecosystem/platform/server/app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,21 @@ def add_oauth_authorization(data)
secret: data['credentials']['secret'],
refresh_token: data['credentials']['refresh_token'],
expires_at:,
email: data['info']['email'].downcase,
profile_url: data['info']['image']
email: data.dig('info', 'email')&.downcase,
profile_url: data.dig('info', 'image')
}
case data['provider']
when 'github'
auth = auth.merge({
username: data['info']['nickname'].downcase,
full_name: data['info']['name']
username: data.dig('info', 'nickname')&.downcase,
full_name: data.dig('info', 'name')
})
when 'discord'
raw_info = data['extra']['raw_info']
auth = auth.merge({
username: "#{raw_info['username'].downcase}##{raw_info['discriminator']}",
full_name: data['info']['name'],
profile_url: data['info']['image']
full_name: data.dig('info', 'name'),
profile_url: data.dig('info', 'image')
})
else
raise 'Unknown Provider!'
Expand Down

0 comments on commit 4a383a9

Please sign in to comment.