簡體   English   中英

忘記密碼/用戶名 Xcode

[英]forgot password/username Xcode

我正在構建登錄/注冊頁面,它的工作非常完美。

但我只想知道如何在登錄頁面上為“忘記密碼或用戶名”添加標簽或按鈕。

  • 我想要一條彈出消息或警報,允許用戶輸入他們的電子郵件
    • 因此,如果他們的電子郵件不存在於數據庫中,則會彈出一條消息,指出該電子郵件不正確或其他內容
    • 如果電子郵件已存在於數據庫中,我想向用戶發送用戶名和新密碼。

請注意,我正在使用解析。

謝謝,

首先顯示一個類型為 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];

並在您的警報視圖委托中

 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM