Skip to content

Commit

Permalink
Replace passport with account references (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
fdocr authored Mar 9, 2022
1 parent 8926bba commit e36127f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Sources/ForemWebView/URL+ForemUtilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ public extension URL {
self.absoluteString.range(of: URL.faceBookRegex, options: .regularExpression) != nil
}

// Forem Passport Auth
var isForemPassportAuth: Bool { self.absoluteString.hasPrefix("https://passport.forem.com/oauth") }
// Forem Account Auth
var isForemAccountAuth: Bool { self.absoluteString.hasPrefix("https://account.forem.com/oauth") }

// GitHub OAuth paths including 2FA + error pages
var isGithubAuth: Bool {
Expand Down Expand Up @@ -46,7 +46,7 @@ public extension URL {
return true
}

if isForemPassportAuth {
if isForemAccountAuth {
return true
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/ForemWebViewTests/ForemWebViewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ final class ForemWebViewTests: XCTestCase {
"https://m.facebook.com/v4.0/dialog/oauth",
"https://m.facebook.com/v6.0/dialog/oauth",
"https://m.facebook.com/login.php?skip_api_login=1&api_key=asdf",
"https://passport.forem.com/oauth/authorize?client_id=IBex_ltWo0tiuoB9CgHt7LCrwTuG5rlwhphjzQdf1RA&redirect_uri=https%3A%2F%2Fgggames.visualcosita.com%2Fusers%2Fauth%2Fforem%2Fcallback&response_type=code&state=de3f6b0c4cac41fdb9abf5409ce2f24e2d743245ca37a53a"
"https://account.forem.com/oauth/authorize?client_id=IBex_ltWo0tiuoB9CgHt7LCrwTuG5rlwhphjzQdf1RA&redirect_uri=https%3A%2F%2Fgggames.visualcosita.com%2Fusers%2Fauth%2Fforem%2Fcallback&response_type=code&state=de3f6b0c4cac41fdb9abf5409ce2f24e2d743245ca37a53a"
]
for urlString in urlStrings {
if let url = URL(string: urlString) {
Expand Down
14 changes: 7 additions & 7 deletions Tests/ForemWebViewTests/URL+ForemUtilitiesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class URL_ForemUtilitiesTests: XCTestCase {
("testIsGoogleAuth", testIsGithubAuth),
("testIsGithubAuth", testIsGoogleAuth),
("testIsFacebookAuth", testIsFacebookAuth),
("testIsForemPassportAuth", testIsForemPassportAuth),
("testIsForemAccountAuth", testIsForemAccountAuth),
("testIsTwitterAuth", testIsTwitterAuth),
]
static let faker = Faker()
Expand Down Expand Up @@ -42,8 +42,8 @@ class URL_ForemUtilitiesTests: XCTestCase {
"https://m.facebook.com/login.php?skip_api_login=1&api_key=asdf",
]

static let passportUrlStrings = [
"https://passport.forem.com/oauth/authorize?client_id=IBex_ltWo0tiuoB9CgHt7LCrwTuG5rlwhphjzQdf1RA&redirect_uri=https%3A%2F%2Fgggames.visualcosita.com%2Fusers%2Fauth%2Fforem%2Fcallback&response_type=code&state=de3f6b0c4cac41fdb9abf5409ce2f24e2d743245ca37a53a"
static let foremAccountUrlStrings = [
"https://account.forem.com/oauth/authorize?client_id=IBex_ltWo0tiuoB9CgHt7LCrwTuG5rlwhphjzQdf1RA&redirect_uri=https%3A%2F%2Fgggames.visualcosita.com%2Fusers%2Fauth%2Fforem%2Fcallback&response_type=code&state=de3f6b0c4cac41fdb9abf5409ce2f24e2d743245ca37a53a"
]

static let googleUrlStrings = [
Expand All @@ -60,7 +60,7 @@ class URL_ForemUtilitiesTests: XCTestCase {
""",
]

static let urlStrings = githubUrlStrings + twitterUrlStrings + facebookUrlStrings + passportUrlStrings + googleUrlStrings
static let urlStrings = githubUrlStrings + twitterUrlStrings + facebookUrlStrings + foremAccountUrlStrings + googleUrlStrings

func testIsOauthURL() {
for urlString in URL_ForemUtilitiesTests.urlStrings {
Expand Down Expand Up @@ -100,10 +100,10 @@ class URL_ForemUtilitiesTests: XCTestCase {
}
}

func testIsForemPassportAuth() {
for urlString in URL_ForemUtilitiesTests.passportUrlStrings {
func testIsForemAccountAuth() {
for urlString in URL_ForemUtilitiesTests.foremAccountUrlStrings {
if let url = URL(string: urlString) {
XCTAssertTrue(url.isForemPassportAuth, "String didn't match as Auth URL: \(urlString)")
XCTAssertTrue(url.isForemAccountAuth, "String didn't match as Auth URL: \(urlString)")
}
}
}
Expand Down

0 comments on commit e36127f

Please sign in to comment.