File tree 2 files changed +22
-1
lines changed
2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -250,6 +250,19 @@ public class Lock: NSObject {
250
250
return self
251
251
}
252
252
253
+ /**
254
+ Register a callback to be notified when a user requests a password reset.
255
+ The callback will yield the user identifier.
256
+
257
+ - parameter callback: called when a user requests a password reset.
258
+
259
+ - returns: Lock itself for chaining
260
+ */
261
+ public func onForgotPassword( callback: @escaping ( String ) -> Void ) -> Lock {
262
+ self . observerStore. onForgotPassword = callback
263
+ return self
264
+ }
265
+
253
266
/**
254
267
Presents Lock from the given controller
255
268
@@ -277,7 +290,7 @@ public class Lock: NSObject {
277
290
return self
278
291
}
279
292
280
- /// Lock's Bundle. Useful for getting bundled resources like images.
293
+ /// Lock's Bundle. Useful for getting bundled resources like images.
281
294
public static var bundle : Bundle {
282
295
return bundleForLock ( )
283
296
}
Original file line number Diff line number Diff line change @@ -176,6 +176,14 @@ class LockSpec: QuickSpec {
176
176
expect ( executed) == true
177
177
}
178
178
179
+ it ( " should register onForgotPassword callback " ) {
180
+ var email : String ? = nil
181
+ let callback : ( String ) -> ( ) = { email = $0 }
182
+ let _ = lock. onForgotPassword ( callback: callback)
183
+ lock
. observerStore
. onForgotPassword ( " [email protected] " )
184
+ expect ( email
) == " [email protected] "
185
+ }
186
+
179
187
it ( " should register onPasswordless callback " ) {
180
188
var email : String ? = nil
181
189
let callback : ( String ) -> ( ) = { email = $0 }
You can’t perform that action at this time.
0 commit comments