magister 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd94a0cc6b6ee2470916892afd0c9ffe626d2c7a31acd3fc2bd7e7e4485415bc
4
- data.tar.gz: 21f397e67ca49836e84af7fd83a425223a30b385e41a116149c2a0b02074fce4
3
+ metadata.gz: a041c24e54b39cc5177fe088ef9dd11a4154b91411760f2918a9b3019d1fbe2e
4
+ data.tar.gz: 7910fa0b041250e2b4a5a1f31d572ea892f48587d934e672e2683a13280ea08a
5
5
  SHA512:
6
- metadata.gz: 53033d79c500d959a80a63f83763091ff28900fdc52356f789022b69da6bce591e53961c7ab30254eff05df8906528daa2acf03ef3ee4336359b4176d29cc732
7
- data.tar.gz: 6b5762af287bbaf677e06d50462d4284856de1817f0c9afa9f76d0b96f3cb03303eebc8926edffbc8eca28ac697a52220641eb2b545ed16ee7b43638e2ccec20
6
+ metadata.gz: 60738e11401ab1e54ccb9f4b786f625b7976cc594b617cdb12f5dd3b00f92a3115f161f223d1493819daa870edce8772e101c4f0eb9386e1f95607fdeb687faa
7
+ data.tar.gz: 4e157d5183e3dde9b8feaf7b7e374d56557ca07ecd4af72731b1a18299c5b04d53f9a8f887772904773f1418db883350c20bbb39acd26ab1c3c599b8c025bfb1
@@ -58,9 +58,26 @@ module Authenticator
58
58
  if $authMode == "local"
59
59
  raise NotImplementedError.new("\n\nLocal authentication mode has not been implemented yet, \nCheck our github for any updates, or if you want to help implementing it!\n")
60
60
  else
61
- puts "Using Selenium with Chrome for authentication."
62
- options = Selenium::WebDriver::Options.chrome(args: ['--headless=new'])
63
- driver = Selenium::WebDriver.for :chrome, options: options
61
+ if $magister_browser == "Chrome"
62
+ puts "Using Selenium with Chrome for authentication."
63
+ if !$magister_disableHeadless
64
+ options = Selenium::WebDriver::Options.chrome(args: ['--headless=new'])
65
+ else
66
+ options = Selenium::WebDriver::Options.chrome(args: [])
67
+ end
68
+ driver = Selenium::WebDriver.for :chrome, options: options
69
+ elsif $magister_browser == "Firefox"
70
+ puts "Using Selenium with Firefox for authentication."
71
+ if !$magister_disableHeadless
72
+ options = Selenium::WebDriver::Options.firefox(args: ['--headless=new'])
73
+ else
74
+ options = Selenium::WebDriver::Options.firefox(args: [])
75
+ end
76
+ driver = Selenium::WebDriver.for :firefox, options: options
77
+ else
78
+ puts "Invalid browser option #{$magister_browser}"
79
+ return
80
+ end
64
81
 
65
82
  driver.get auth_uri
66
83
  while !driver.current_url.start_with? "https://accounts.magister.net/account/login"
data/lib/magister.rb CHANGED
@@ -9,6 +9,10 @@ require 'magister/authenticator'
9
9
  # "selenium" will run headlessly
10
10
  # "local" will open a browser window for the user to login
11
11
  $authMode = "selenium"
12
+ # Set what browser to use [Chrome|Firefox]
13
+ $magister_browser = "Chrome"
14
+ # To show the browser window for debugging purposes
15
+ $magister_disableHeadless = false
12
16
 
13
17
  # Caching options
14
18
  $magister_useCache = true
@@ -55,6 +59,7 @@ class Magister
55
59
  # @since 1.1.0
56
60
  def login(school, username, password)
57
61
  @profile = Authenticator.login(username, password, school)
62
+ @profile.verify
58
63
  end
59
64
 
60
65
  # Get the users profile
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magister
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Riley0122
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-21 00:00:00.000000000 Z
11
+ date: 2024-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json