]> source.dussan.org Git - nextcloud-server.git/commitdiff
Dont use the old .status way
authorJoas Schilling <nickvergessen@owncloud.com>
Mon, 20 Apr 2015 16:15:06 +0000 (18:15 +0200)
committerJoas Schilling <nickvergessen@owncloud.com>
Mon, 20 Apr 2015 16:26:14 +0000 (18:26 +0200)
apps/encryption/controller/settingscontroller.php
apps/encryption/js/settings-personal.js
apps/encryption/tests/controller/SettingsControllerTest.php

index 1555ff0c65418621140119c20852d84fa0a27e6d..7fa3f469a14441ff0e45e34b744178349006df04 100644 (file)
@@ -118,23 +118,14 @@ class SettingsController extends Controller {
                if ($result === true) {
                        $this->session->setStatus(Session::INIT_SUCCESSFUL);
                        return new DataResponse(
-                               ['data' => [
-                                               'status' => 'success',
-                                               'message' => (string) $this->l->t('Private key password successfully updated.'),
-                                       ],
-                               ]
+                               ['message' => (string) $this->l->t('Private key password successfully updated.')]
                        );
                } else {
                        return new DataResponse(
-                               ['data' => [
-                                               'message' => (string) $errorMessage,
-                                       ],
-                               ],
+                               ['message' => (string) $errorMessage],
                                Http::STATUS_BAD_REQUEST
                        );
                }
 
        }
-
-
 }
index dcfbba4ecde6026329fb6c73f4c9b547a3cd1417..68609877c05e2c92347766ca751e14bd646640dc 100644 (file)
@@ -9,16 +9,13 @@ function updatePrivateKeyPasswd() {
        var newPrivateKeyPassword = $('input:password[id="newPrivateKeyPassword"]').val();
        OC.msg.startSaving('#encryption .msg');
        $.post(
-       OC.generateUrl('/apps/encryption/ajax/updatePrivateKeyPassword')
-               , { oldPassword: oldPrivateKeyPassword, newPassword: newPrivateKeyPassword }
-               ,  function( data ) {
-                       if (data.status === "error") {
-                               OC.msg.finishedSaving('#encryption .msg', data);
-                       } else {
-                               OC.msg.finishedSaving('#encryption .msg', data);
-                       }
-               }
-       );
+               OC.generateUrl('/apps/encryption/ajax/updatePrivateKeyPassword'),
+               { oldPassword: oldPrivateKeyPassword, newPassword: newPrivateKeyPassword }
+       ).success(function(response) {
+               OC.msg.finishedSuccess('#encryption .msg', response.message);
+       }).fail(function(response) {
+               OC.msg.finishedError('#encryption .msg', response.responseJSON.message);
+       });
 }
 
 $(document).ready(function(){
index a12773790a92bc0bfa9e2726c8de405d3b106cf7..478bf8213b5f05d1de44e9c2948a71a98dcdefdd 100644 (file)
@@ -131,7 +131,7 @@ class SettingsControllerTest extends TestCase {
 
                $this->assertSame(Http::STATUS_BAD_REQUEST, $result->getStatus());
                $this->assertSame('The current log-in password was not correct, please try again.',
-                       $data['data']['message']);
+                       $data['message']);
        }
 
        /**
@@ -158,7 +158,7 @@ class SettingsControllerTest extends TestCase {
 
                $this->assertSame(Http::STATUS_BAD_REQUEST, $result->getStatus());
                $this->assertSame('The old password was not correct, please try again.',
-                       $data['data']['message']);
+                       $data['message']);
        }
 
        /**
@@ -216,7 +216,7 @@ class SettingsControllerTest extends TestCase {
 
                $this->assertSame(Http::STATUS_OK, $result->getStatus());
                $this->assertSame('Private key password successfully updated.',
-                       $data['data']['message']);
+                       $data['message']);
        }
 
 }