该文档未提供有关如何或事件是否可以更改用户的任何信息。来自应用的密码。
我们目前正在向用户发送电子邮件,这会打开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;
但似乎没有办法从Firebase控制台生成Swift中的代码。
代码似乎在电子邮件模板%LINK%
中提供,但它没有说明是否可以仅提供代码。
所以我的问题是,有没有办法在移动应用程序中重置密码屏幕,最好是在iOS应用程序中?如果是这样,我如何将该代码发送给用户?
答案 0 :(得分:0)
Auth.auth().currentUser?.updatePassword(to: password) { (error) in
// ...
}
用于当前登录的用户。