Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit cd53ee3

Browse files
authored
Support requesting account creation when sending auth magic link (#861)
2 parents f591b6e + 7226ee2 commit cd53ee3

File tree

6 files changed

+47
-35
lines changed

6 files changed

+47
-35
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ _None._
3939
### New Features
4040

4141
- Add support for logging in into WPCOM suspended sites.
42+
- Update `WordPressComAccountService/requestAuthenticationLink` with a new argument `createAccountIfNotFound` to allow creating new accounts. [#861]
4243

4344
### Bug Fixes
4445

Gemfile.lock

+32-25
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
CFPropertyList (3.0.6)
4+
CFPropertyList (3.0.7)
5+
base64
6+
nkf
57
rexml
6-
activesupport (7.1.2)
8+
activesupport (7.2.2)
79
base64
10+
benchmark (>= 0.3)
811
bigdecimal
9-
concurrent-ruby (~> 1.0, >= 1.0.2)
12+
concurrent-ruby (~> 1.0, >= 1.3.1)
1013
connection_pool (>= 2.2.5)
1114
drb
1215
i18n (>= 1.6, < 2)
16+
logger (>= 1.4.2)
1317
minitest (>= 5.1)
14-
mutex_m
15-
tzinfo (~> 2.0)
16-
addressable (2.8.6)
17-
public_suffix (>= 2.0.2, < 6.0)
18+
securerandom (>= 0.3)
19+
tzinfo (~> 2.0, >= 2.0.5)
20+
addressable (2.8.7)
21+
public_suffix (>= 2.0.2, < 7.0)
1822
algoliasearch (1.27.5)
1923
httpclient (~> 2.8, >= 2.8.3)
2024
json (>= 1.5.1)
@@ -39,7 +43,8 @@ GEM
3943
aws-eventstream (~> 1, >= 1.0.2)
4044
babosa (1.0.4)
4145
base64 (0.2.0)
42-
bigdecimal (3.1.5)
46+
benchmark (0.4.0)
47+
bigdecimal (3.1.8)
4348
buildkit (1.5.0)
4449
sawyer (>= 0.6)
4550
chroma (0.2.0)
@@ -48,10 +53,10 @@ GEM
4853
cork
4954
nap
5055
open4 (~> 1.3)
51-
cocoapods (1.14.3)
56+
cocoapods (1.16.2)
5257
addressable (~> 2.8)
5358
claide (>= 1.0.2, < 2.0)
54-
cocoapods-core (= 1.14.3)
59+
cocoapods-core (= 1.16.2)
5560
cocoapods-deintegrate (>= 1.0.3, < 2.0)
5661
cocoapods-downloader (>= 2.1, < 3.0)
5762
cocoapods-plugins (>= 1.0.0, < 2.0)
@@ -65,10 +70,10 @@ GEM
6570
molinillo (~> 0.8.0)
6671
nap (~> 1.0)
6772
ruby-macho (>= 2.3.0, < 3.0)
68-
xcodeproj (>= 1.23.0, < 2.0)
73+
xcodeproj (>= 1.27.0, < 2.0)
6974
cocoapods-check (1.1.0)
7075
cocoapods (~> 1.0)
71-
cocoapods-core (1.14.3)
76+
cocoapods-core (1.16.2)
7277
activesupport (>= 5.0, < 8)
7378
addressable (~> 2.8)
7479
algoliasearch (~> 1.0)
@@ -91,7 +96,7 @@ GEM
9196
colored2 (3.1.2)
9297
commander (4.6.0)
9398
highline (~> 2.0.0)
94-
concurrent-ruby (1.2.2)
99+
concurrent-ruby (1.3.4)
95100
connection_pool (2.4.1)
96101
cork (0.3.0)
97102
colored2 (~> 3.1)
@@ -137,8 +142,7 @@ GEM
137142
rake (>= 12.0.0, < 14.0.0)
138143
domain_name (0.6.20231109)
139144
dotenv (2.8.1)
140-
drb (2.2.0)
141-
ruby2_keywords
145+
drb (2.2.1)
142146
emoji_regex (3.2.3)
143147
escape (0.0.4)
144148
ethon (0.16.0)
@@ -232,7 +236,8 @@ GEM
232236
rake (>= 12.3, < 14.0)
233237
rake-compiler (~> 1.0)
234238
xcodeproj (~> 1.22)
235-
ffi (1.16.3)
239+
ffi (1.17.0)
240+
ffi (1.17.0-x86_64-darwin)
236241
fourflusher (2.3.1)
237242
fuzzy_match (2.0.4)
238243
gh_inspector (1.1.3)
@@ -281,29 +286,30 @@ GEM
281286
http-cookie (1.0.5)
282287
domain_name (~> 0.5)
283288
httpclient (2.8.3)
284-
i18n (1.14.1)
289+
i18n (1.14.6)
285290
concurrent-ruby (~> 1.0)
286291
java-properties (0.3.0)
287292
jmespath (1.6.2)
288-
json (2.7.1)
293+
json (2.8.2)
289294
jwt (2.7.1)
290295
kramdown (2.4.0)
291296
rexml
292297
kramdown-parser-gfm (1.1.0)
293298
kramdown (~> 2.0)
294299
language_server-protocol (3.17.0.3)
300+
logger (1.6.1)
295301
mini_magick (4.12.0)
296302
mini_mime (1.1.5)
297303
mini_portile2 (2.8.5)
298-
minitest (5.20.0)
304+
minitest (5.25.1)
299305
molinillo (0.8.0)
300306
multi_json (1.15.0)
301307
multipart-post (2.3.0)
302-
mutex_m (0.2.0)
303-
nanaimo (0.3.0)
308+
nanaimo (0.4.0)
304309
nap (1.1.0)
305310
naturally (2.2.1)
306311
netrc (0.11.0)
312+
nkf (0.2.0)
307313
no_proxy_fix (0.1.2)
308314
nokogiri (1.15.5)
309315
mini_portile2 (~> 2.8.2)
@@ -339,7 +345,7 @@ GEM
339345
trailblazer-option (>= 0.1.1, < 0.2.0)
340346
uber (< 0.2.0)
341347
retriable (3.1.2)
342-
rexml (3.2.6)
348+
rexml (3.3.9)
343349
rouge (2.0.7)
344350
rubocop (1.60.2)
345351
json (~> 2.3)
@@ -361,6 +367,7 @@ GEM
361367
sawyer (0.9.2)
362368
addressable (>= 2.3.5)
363369
faraday (>= 0.17.3, < 3)
370+
securerandom (0.3.2)
364371
security (0.1.3)
365372
signet (0.18.0)
366373
addressable (~> 2.8)
@@ -387,13 +394,13 @@ GEM
387394
unicode-display_width (2.5.0)
388395
webrick (1.8.1)
389396
word_wrap (1.0.0)
390-
xcodeproj (1.23.0)
397+
xcodeproj (1.27.0)
391398
CFPropertyList (>= 2.3.3, < 4.0)
392399
atomos (~> 0.1.3)
393400
claide (>= 1.0.2, < 2.0)
394401
colored2 (~> 3.1)
395-
nanaimo (~> 0.3.0)
396-
rexml (~> 3.2.4)
402+
nanaimo (~> 0.4.0)
403+
rexml (>= 3.3.6, < 4.0)
397404
xcpretty (0.3.0)
398405
rouge (~> 2.0.7)
399406
xcpretty-travis-formatter (1.0.1)

Podfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def wordpress_authenticator_pods
3131
## These should match the version requirement from the podspec.
3232
pod 'Gridicons', '~> 1.0'
3333
pod 'WordPressUI', '~> 1.7-beta'
34-
pod 'WordPressKit', '~> 17.0'
34+
pod 'WordPressKit', '~> 17.3'
3535
pod 'WordPressShared', '~> 2.1-beta'
3636

3737
third_party_pods

Podfile.lock

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ PODS:
1212
- Gridicons (~> 1.0)
1313
- "NSURL+IDN (= 0.4)"
1414
- SVProgressHUD (~> 2.2.5)
15-
- WordPressKit (~> 17.0)
15+
- WordPressKit (~> 17.3)
1616
- WordPressShared (~> 2.1-beta)
1717
- WordPressUI (~> 1.7-beta)
18-
- WordPressKit (17.0.0):
18+
- WordPressKit (17.3.0):
1919
- NSObject-SafeExpectations (~> 0.0.4)
2020
- UIDeviceIdentifier (~> 2.0)
2121
- WordPressShared (~> 2.0-beta)
@@ -33,7 +33,7 @@ DEPENDENCIES:
3333
- SVProgressHUD (= 2.2.5)
3434
- SwiftLint (= 0.54.0)
3535
- WordPressAuthenticator (from `.`)
36-
- WordPressKit (~> 17.0)
36+
- WordPressKit (~> 17.3)
3737
- WordPressShared (~> 2.1-beta)
3838
- WordPressUI (~> 1.7-beta)
3939

@@ -67,12 +67,12 @@ SPEC CHECKSUMS:
6767
SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6
6868
SwiftLint: c1de071d9d08c8aba837545f6254315bc900e211
6969
UIDeviceIdentifier: 442b65b4ff1832d4ca9c2a157815cb29ad981b17
70-
WordPressAuthenticator: d151cc7ebc1cfcbf5c28bb2c9afe760a75b49ba6
71-
WordPressKit: a71cc550f4b525ab5eef057984c8de071462edd5
70+
WordPressAuthenticator: 0f4f47d6f71cfa763cb636876d69170a3c710002
71+
WordPressKit: faf8c6de7c2acfe71cf95b4db896901060967089
7272
WordPressShared: 87f3ee89b0a3e83106106f13a8b71605fb8eb6d2
7373
WordPressUI: a491454affda3b0fb812812e637dc5e8f8f6bd06
7474
wpxmlrpc: 68db063041e85d186db21f674adf08d9c70627fd
7575

76-
PODFILE CHECKSUM: 98c48a8558a07d876e1720351adcb835bc40ce14
76+
PODFILE CHECKSUM: 39dc5efbdeec9efbe53518c7b5dd0e7853526c1c
7777

78-
COCOAPODS: 1.14.3
78+
COCOAPODS: 1.16.2

WordPressAuthenticator.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ Pod::Spec.new do |s|
4040
# Use a loose restriction that allows both production and beta versions, up to the next major version.
4141
# If you want to update which of these is used, specify it in the host app.
4242
s.dependency 'WordPressUI', '~> 1.7-beta'
43-
s.dependency 'WordPressKit', '~> 17.0'
43+
s.dependency 'WordPressKit', '~> 17.3'
4444
s.dependency 'WordPressShared', '~> 2.1-beta'
4545
end

WordPressAuthenticator/Services/WordPressComAccountService.swift

+5-1
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,18 @@ public class WordPressComAccountService {
4747

4848
/// Requests a WordPress.com Authentication Link to be sent to the specified email address.
4949
///
50-
public func requestAuthenticationLink(for email: String, jetpackLogin: Bool, success: @escaping () -> Void, failure: @escaping (Error) -> Void) {
50+
public func requestAuthenticationLink(for email: String,
51+
jetpackLogin: Bool,
52+
createAccountIfNotFound: Bool = false,
53+
success: @escaping () -> Void, failure: @escaping (Error) -> Void) {
5154
let remote = AccountServiceRemoteREST(wordPressComRestApi: anonymousAPI)
5255

5356
remote.requestWPComAuthLink(forEmail: email,
5457
clientID: configuration.wpcomClientId,
5558
clientSecret: configuration.wpcomSecret,
5659
source: jetpackLogin ? .jetpackConnect : .default,
5760
wpcomScheme: configuration.wpcomScheme,
61+
createAccountIfNotFound: createAccountIfNotFound,
5862
success: success,
5963
failure: { error in
6064
let result = error ?? ServiceError.unknown

0 commit comments

Comments
 (0)