gpt4 book ai didi

ios - 解析开源服务器重置密码错误

转载 作者:行者123 更新时间:2023-12-01 18:08:28 24 4
gpt4 key购买 nike

我将解析服务器更新为可在AWS上运行,当我击中重置密码但登录有效时,出现此错误。我不确定为什么这部分代码有错误,而不是其他登录和注册。 Error Domain=Parse Code=1 "{"code":1,"message":"Internal server error."}" UserInfo={error={"code":1,"message":"Internal server error."}, NSLocalizedDescription={"code":1,"message":"Internal server error."}, code=1} enter image description here enter image description here
这是我必须重置的代码。

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{

switch (alertView.alertViewStyle)
{
case UIAlertViewStylePlainTextInput:
{
UITextField *textField = [alertView textFieldAtIndex:0];
NSLog(@"Plain text input: %@",textField.text);
NSString *original = textField.text;
NSString *lowercase = [original lowercaseString];

NSLog(@"lowercase == %@",lowercase);
// [PFUser requestPasswordResetForEmailInBackground:@"connorsapps@yahoo.com"];

[PFUser requestPasswordResetForEmailInBackground:lowercase block:^(BOOL succeeded, NSError * _Nullable error) {
NSLog(@"error == %@",error);
if(error){
[[[UIAlertView alloc] initWithTitle:@"Password Reset Error"
message:@"There was a Error reseting your email."
delegate:nil
cancelButtonTitle:@"ok"
otherButtonTitles:nil] show];

} else if (!error){
[[[UIAlertView alloc] initWithTitle:@"Password Reset"
message:@"An email containing information on how to reset your password has been sent to your email."
delegate:nil
cancelButtonTitle:@"ok"
otherButtonTitles:nil] show];
}

}];




}
break;

case UIAlertViewStyleSecureTextInput:
{
UITextField *textField = [alertView textFieldAtIndex:0];
NSLog(@"Secure text input: %@",textField.text);
}
break;

case UIAlertViewStyleLoginAndPasswordInput:
{
UITextField *loginField = [alertView textFieldAtIndex:0];
NSLog(@"Login input: %@",loginField.text);

UITextField *passwordField = [alertView textFieldAtIndex:1];
NSLog(@"Password input: %@",passwordField.text);
}
break;

default:
break;
}
}

最佳答案

您是否设置了电子邮件适配器?

看看:https://github.com/ParsePlatform/parse-server

电子邮件验证和密码重置

验证用户电子邮件地址并通过电子邮件启用密码重置需要电子邮件适配器。作为parse-server软件包的一部分,我们提供了一个用于通过Mailgun发送电子邮件的适配器。要使用它,请注册Mailgun,并将其添加到您的初始化代码中:

var server = ParseServer({
...otherOptions,
// Enable email verification
verifyUserEmails: true,
// The public URL of your app.
// This will appear in the link that is used to verify email addresses and reset passwords.
// Set the mount path as it is in serverURL
publicServerURL: 'https://example.com/parse',
// Your apps name. This will appear in the subject and body of the emails that are sent.
appName: 'Parse App',
// The email adapter
emailAdapter: {
module: 'parse-server-simple-mailgun-adapter',
options: {
// The address that your emails come from
fromAddress: 'parse@example.com',
// Your domain from mailgun.com
domain: 'example.com',
// Your API key from mailgun.com
apiKey: 'key-mykey',
}
}
});

您还可以使用社区提供的其他电子邮件适配器,例如parse-server-sendgrid-adapter或parse-server-mandrill-adapter。

将其添加到解析服务器的实例化中,如果您从git下载parse-server,则其原始外观如下所示。
var api = new ParseServer({
serverURL: process.env.SERVER_URL,
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'myAppId',
masterKey: process.env.MASTER_KEY || '' //Add your master key here. Keep it secret!
});

因此,将第一个代码段附加到上述示例的底部。
var api = new ParseServer({
serverURL: process.env.SERVER_URL,
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'myAppId',
masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
verifyUserEmails: true,
publicServerURL: 'https://example.com/parse',
// Your apps name. This will appear in the subject and body of the emails that are sent.
appName: 'Parse App',
// The email adapter
emailAdapter: {
module: 'parse-server-simple-mailgun-adapter',
options: {
// The address that your emails come from
fromAddress: 'parse@example.com',
// Your domain from mailgun.com
domain: 'example.com',
// Your API key from mailgun.com
apiKey: 'key-mykey',
}
}
});

关于ios - 解析开源服务器重置密码错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36415650/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com