【发布时间】:2018-10-13 04:25:29
【问题描述】:
如果可以从应用程序更改用户密码,该文档未提供有关如何或事件的任何信息。
我们目前正在向打开 Firebase 页面的用户发送一封电子邮件,但它不会强制执行密码复杂性。
我们希望有一个屏幕,用户可以在其中重置密码。
在 FirebaseAuth.framework 中有这个方法:
/** @fn confirmPasswordResetWithCode:newPassword:completion:
@brief Resets the password given a code sent to the user outside of the app and a new password
for the user.
@param newPassword The new password.
@param completion Optionally; a block which is invoked when the request finishes. Invoked
asynchronously on the main thread in the future.
@remarks Possible error codes:
+ `FIRAuthErrorCodeWeakPassword` - Indicates an attempt to set a password that is
considered too weak.
+ `FIRAuthErrorCodeOperationNotAllowed` - Indicates the administrator disabled sign
in with the specified identity provider.
+ `FIRAuthErrorCodeExpiredActionCode` - Indicates the OOB code is expired.
+ `FIRAuthErrorCodeInvalidActionCode` - Indicates the OOB code is invalid.
@remarks See `FIRAuthErrors` for a list of error codes that are common to all API methods.
**/
- (void)confirmPasswordResetWithCode:(NSString *)code
newPassword:(NSString *)newPassword
completion:(FIRConfirmPasswordResetCallback)completion;
以及验证该代码的其他方法:
/** @fn verifyPasswordResetCode:completion:
@brief Checks the validity of a verify password reset code.
@param code The password reset code to be verified.
@param completion Optionally; a block which is invoked when the request finishes. Invoked
asynchronously on the main thread in the future.
*/
- (void)verifyPasswordResetCode:(NSString *)code
completion:(FIRVerifyPasswordResetCodeCallback)completion;
但似乎没有办法在 Swift 中生成该代码,也不是从 Firebase 控制台。
代码似乎在电子邮件模板%LINK% 中提供,但没有说明是否可以仅提供代码。
所以我的问题是,有没有办法在移动应用程序中设置密码重置屏幕,最好是在 iOS 应用程序中?如果是这样,我如何将该代码发送给用户?
【问题讨论】:
标签: swift firebase firebase-authentication