在我的iOS應用程序,我需要我的用戶能夠恢復/重置他們的密碼。我正在使用Drupal iOS SDK來管理用戶登錄。一切正常,但我試圖找出如何發佈用戶的電子郵件地址的服務終點,以觸發drupal密碼恢復電子郵件? 例如用戶將電子郵件輸入到UITextField中,然後點擊提交按鈕。但是,似乎沒有任何文件?iOS - 觸發密碼恢復從Drupal電子郵件
代碼如下 - 我只是不知道我應該把什麼方法放在我的sendButton? DIOSUser? DIOSSession?
DIOSUser.m
+ (void)userSendPasswordRecoveryEmailWithEmailAddress: (NSString*)email
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
NSString *path = [NSString stringWithFormat:@"user/request_new_password/%@", email];
NSLog(@"This is the input email %@", email);
[[DIOSSession sharedSession] sendRequestWithPath:path method:@"POST" params:nil success:success failure:failure];
}
ViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
self.forgotField.returnKeyType = UIReturnKeyDone;
[self.forgotField setDelegate:self];
// Do any additional setup after loading the view from its nib.
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissKeyboard)];
[self.view addGestureRecognizer:tap];
}
- (IBAction)return:(id)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
- (IBAction)sendButton:(id)sender {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Retrieving Password"
message:@"We're helping you retrieve your password! Please check your email in a few minutes for a rescue link."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
錯誤日誌:
2017-07-12 22:29:34.264669-0700 myApp[4523:1331335]
----- DIOS Failure -----
Status code: 404
URL: http://url.com/endpoint01/user/request_new_password/[email protected]
----- Response -----
----- Error -----
Request failed: not found (404)
您是否嘗試過在建議https://drupal.stackexchange.com/questions/215281/password-reset-causing-404 – Ellen
提到的請嘗試我的答案,下面 – Dhiru