【发布时间】:2017-02-17 01:55:29
【问题描述】:
在我的 iOS 应用中,我需要我的用户能够恢复/重置他们的密码。我正在使用 Drupal iOS SDK 来管理用户登录。一切正常,但是我试图弄清楚如何将用户的电子邮件地址发布到服务端点以触发 drupal 密码恢复电子邮件? 例如用户在 UITextField 中输入电子邮件,然后点击提交按钮。但是似乎没有任何文档?
代码如下 - 我只是不确定应该在我的 sendButton 中放置什么方法? DIOS用户? 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/me@email.com
----- Response -----
----- Error -----
Request failed: not found (404)
【问题讨论】:
-
请试试我的回答,如下
标签: ios objective-c drupal