[英]forgot password/username Xcode
I am building login/signup pages and it's work so perfectly.我正在构建登录/注册页面,它的工作非常完美。
But I just want to know how I can add a label or a button for the "Forgot my password or username" on the login page.但我只想知道如何在登录页面上为“忘记密码或用户名”添加标签或按钮。
Please note that I am using parse.请注意,我正在使用解析。
Thank you,谢谢,
First display an alert view with type UIAlertViewStylePlainTextInput首先显示一个类型为 UIAlertViewStylePlainTextInput 的警报视图
UIAlertView * forgotPassword=[[UIAlertView alloc] initWithTitle:@"Forgot Password" message:@"Please enter your email id" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil];
forgotPassword.alertViewStyle=UIAlertViewStylePlainTextInput;
[forgotPassword textFieldAtIndex:0].delegate=self;
[forgotPassword show];
and in your alert view delegate并在您的警报视图委托中
if(buttonIndex ==1){
NSLog(@"ok button clicked in forgot password alert view");
NSString *femailId=[alertView textFieldAtIndex:0].text;
if ([femailId isEqualToString:@""]) {
UIAlertView *display;
display=[[UIAlertView alloc] initWithTitle:@"Email" message:@"Please enter password for resetting password" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles: nil];
[display show];
}else{
[PFUser requestPasswordResetForEmailInBackground:femailId block:^(BOOL succeeded, NSError *error) {
UIAlertView *display;
if(succeeded){
display=[[UIAlertView alloc] initWithTitle:@"Password email" message:@"Please check your email for resetting the password" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles: nil];
}else{
display=[[UIAlertView alloc] initWithTitle:@"Email" message:@"Email doesn't exists in our database" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles: nil];
}
[display show];
}];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.