W mojej aplikacji na iOS potrzebuję, aby moi użytkownicy mogli odzyskać/zresetować swoje hasła. Używam Drupal iOS SDK do zarządzania loginem użytkownika. Wszystko działa, ale staram się dowiedzieć, jak opublikować adres e-mail użytkownika w punkcie końcowym usługi, aby wywołać wiadomość e-mail odzyskiwania hasła. E.g. użytkownik wprowadza wiadomość e-mail do UITextField i stuka przycisk wysyłania. Jednak nie ma na to żadnej dokumentacji?iOS - Password odzyskiwania hasła e-mail od Drupal
Kod jest następujący - Po prostu nie jestem pewien, jaką metodę powinienem wprowadzić do mojego 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];
}
dziennika błędu:
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)
Czy próbowali sugestia wspomniano w https://drupal.stackexchange.com/questions/215281/password-reset-causing-404 – Ellen
Spróbuj moją odpowiedź poniżej – Dhiru