2016-04-05 14 views
1

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 hereenter 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:@"[email protected]"]; 

    [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; 
    } 
} 

答えて

4

電子メールアダプターを設定しましたか?

を見てみましょう:

は、ユーザーの電子メールアドレスを確認し、電子メールを介してパスワードのリセットを有効にリセットhttps://github.com/ParsePlatform/parse-server

メールの確認やパスワードをメールアダプタをrequries。解析サーバパッケージの一環として、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: '[email protected]', 
     // Your domain from mailgun.com 
     domain: 'example.com', 
     // Your API key from mailgun.com 
     apiKey: 'key-mykey', 
    } 
    } 
}); 

ます。また、このような構文解析サーバsendgrid・アダプタまたはパース・サーバー・マンドリルなどのコミュニティによって寄与他の電子メール・アダプターを使用することができます。これを使用するには、Mailgunにサインアップして、あなたの初期化コードにこれを追加-アダプタ。

パースサーバのインスタンス化にこれを追加します。パースサーバをgitからダウンロードすると、元々は以下のようになります。

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: '[email protected]', 
     // Your domain from mailgun.com 
     domain: 'example.com', 
     // Your API key from mailgun.com 
     apiKey: 'key-mykey', 
     } 
    } 
}); 
+0

ありがとうございます私は電子メールアダプターが行ったことはわかりませんでした – Connor

+0

どこにコードを入れますか? – Connor

+0

@Conner:元の回答を編集しました。 – tanz

関連する問題