瀏覽代碼

#2072

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 2 年之前
父節點
當前提交
7b5fcd5ab6

+ 2 - 4
iOSClient/Settings/NCEndToEndInitialize.swift

@@ -210,8 +210,8 @@ class NCEndToEndInitialize: NSObject {
 
                 case NCGlobal.shared.errorResourceNotFound:
                     // message
-                    let e2ePassphrase = NYMnemonic.generateString(128, language: "english")
-                    let message = "\n" + NSLocalizedString("_e2e_settings_view_passphrase_", comment: "") + "\n\n" + e2ePassphrase!
+                    guard let e2ePassphrase = NYMnemonic.generateString(128, language: "english") else { return }
+                    let message = "\n" + NSLocalizedString("_e2e_settings_view_passphrase_", comment: "") + "\n\n" + e2ePassphrase
 
                     let alertController = UIAlertController(title: NSLocalizedString("_e2e_settings_title_", comment: ""), message: NSLocalizedString(message, comment: ""), preferredStyle: .alert)
 
@@ -220,9 +220,7 @@ class NCEndToEndInitialize: NSObject {
                         var privateKeyString: NSString?
 
                         guard let privateKeyChiper = NCEndToEndEncryption.sharedManager().encryptPrivateKey(self.appDelegate.userId, directory: CCUtility.getDirectoryUserData(), passphrase: e2ePassphrase, privateKey: &privateKeyString) else {
-
                             NCContentPresenter.shared.messageNotification("E2E privateKey", description: "Serious internal error to create PrivateKey chiper", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max)
-
                             return
                         }
 

+ 6 - 1
iOSClient/Settings/NCManageEndToEndEncryption.m

@@ -345,8 +345,13 @@
         NSString *message = [NSString stringWithFormat:@"\n%@\n\n\n%@", NSLocalizedString(@"_e2e_settings_the_passphrase_is_", nil), e2ePassphrase];
         
         UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_info_", nil) message:message preferredStyle:UIAlertControllerStyleAlert];
-        UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK action") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { }];
+        UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { }];
+        UIAlertAction *copyPassphrase = [UIAlertAction actionWithTitle:NSLocalizedString(@"_copy_passphrase_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
+            UIPasteboard.generalPasteboard.string = e2ePassphrase;
+        }];
+
         [alertController addAction:okAction];
+        [alertController addAction:copyPassphrase];
         [self presentViewController:alertController animated:YES completion:nil];
         
     } else if ([passcodeType isEqualToString:@"removeLocallyEncryption"]) {

+ 2 - 0
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -875,6 +875,8 @@
 "_waiting_for_"             = "Waiting for:";
 "_reachable_wifi_"          = "network reachable via Wi-Fi or cable";
 "_ITMS-90076_"              = "Due to a change in the Nextcloud application identifier, the settings and password for accessing your cloud are reset, so please re-enter your account data and check your Settings. We are sorry about what happened but it is not up to us.";
+"_copy_passphrase_"        = "Copy passphrase";
+
 
 // Video
 "_select_trace_"            = "Select the trace";