blob: 66b01d1a77c9cf602ae5ffc84a7aa055af2b94ee [file] [log] [blame]
Kateryna Kostiuk1f8c1252018-07-30 18:18:57 -04001/*
2 * Copyright (C) 2015-2018 Savoir-faire Linux Inc.
3 * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
4 * Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20#import "AccRingGeneralVC.h"
21
22//cocoa
23#import <Quartz/Quartz.h>
24
25
26//Qt
27#import <QSize>
28#import <QtMacExtras/qmacfunctions.h>
29#import <QPixmap>
30
31//LRC
32#import <api/lrc.h>
33#import <api/newaccountmodel.h>
34#import <api/newdevicemodel.h>
35#import <interfaces/pixmapmanipulatori.h>
36#import <globalinstances.h>
37
38#import "RegisterNameWC.h"
39#import "RestoreAccountWC.h"
40#import "BackupAccountWC.h"
41#import "views/NSColor+RingTheme.h"
42#import "views/NSImage+Extensions.h"
43#import "views/HoverTableRowView.h"
44#import "ExportPasswordWC.h"
45#import "utils.h"
46
47@interface AccRingGeneralVC ()
48
49@property (unsafe_unretained) IBOutlet NSTextField *displayNameField;
50@property (unsafe_unretained) IBOutlet NSTextField *ringIDField;
51@property (unsafe_unretained) IBOutlet NSTextField *registeredNameField;
52@property (unsafe_unretained) IBOutlet NSButton *registerNameButton;
53@property (unsafe_unretained) IBOutlet NSButton* photoView;
54@property (unsafe_unretained) IBOutlet NSButton* passwordButton;
55@property (unsafe_unretained) IBOutlet NSButton* removeAccountButton;
56@property (unsafe_unretained) IBOutlet NSImageView* addProfilePhotoImage;
57@property (unsafe_unretained) IBOutlet NSTableView* devicesTableView;
58@property (unsafe_unretained) IBOutlet NSTableView* blockedContactsTableView;
59@property (assign) IBOutlet NSLayoutConstraint* buttonRegisterWidthConstraint;
60@property (assign) IBOutlet NSLayoutConstraint* bannedContactHeightConstraint;
61@property (assign) IBOutlet NSLayoutConstraint* advancedButtonMarginConstraint;
62
63
64@property AbstractLoadingWC* accountModal;
65@property PasswordChangeWC* passwordModal;
66@property std::string selectedAccountID;
67
68@end
69
70@implementation AccRingGeneralVC
71
72QMetaObject::Connection deviceAddedSignal;
73QMetaObject::Connection deviceRevokedSignal;
74QMetaObject::Connection deviceUpdatedSignal;
75QMetaObject::Connection contactBlockedSignal;
76QMetaObject::Connection bannedContactsChangedSignal;
77
78
79@synthesize displayNameField;
80@synthesize ringIDField;
81@synthesize registeredNameField;
82@synthesize photoView;
83@synthesize addProfilePhotoImage;
84@synthesize accountModel;
85@synthesize registerNameButton, passwordButton, removeAccountButton;
86@synthesize buttonRegisterWidthConstraint;
87@synthesize accountModal;
88@synthesize delegate;
89@synthesize devicesTableView;
90@synthesize blockedContactsTableView;
91
92
93typedef NS_ENUM(NSInteger, TagViews) {
94 DISPLAYNAME = 100,
95 DEVICE_NAME_TAG = 200,
96 DEVICE_ID_TAG = 300,
97 DEVICE_EDIT_TAG = 400,
98 DEVICE_REVOKE_TAG = 500,
99 BANNED_CONTACT_NAME_TAG = 600,
100 BANNED_CONTACT_ID_TAG = 700,
101 UNBLOCK_CONTACT_TAG = 800
102};
103
104-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountmodel:(lrc::api::NewAccountModel*) accountModel
105{
106 if (self = [self initWithNibName: nibNameOrNil bundle:nibBundleOrNil])
107 {
108 self.accountModel= accountModel;
109 }
110 return self;
111}
112
113- (void)awakeFromNib
114{
115 [super awakeFromNib];
116 [photoView setBordered:YES];
117 [addProfilePhotoImage setWantsLayer: YES];
118 devicesTableView.delegate = self;
119 devicesTableView.dataSource = self;
120 blockedContactsTableView.delegate = self;
121 blockedContactsTableView.dataSource= self;
Kateryna Kostiuk3164fb02018-08-28 17:51:43 -0400122 [[self view] setAutoresizingMask: NSViewMinXMargin | NSViewMaxXMargin | NSViewHeightSizable];
Kateryna Kostiuk1f8c1252018-07-30 18:18:57 -0400123}
124
125- (void)viewDidLoad {
126 [super viewDidLoad];
127 [self updateView];
128}
129
130- (void) setSelectedAccount:(std::string) account {
131 self.selectedAccountID = account;
132 [self connectSignals];
133 [self updateView];
134 [self hideBannedContacts];
135}
136
137-(void) updateView {
138 const auto& account = accountModel->getAccountInfo(self.selectedAccountID);
139 QByteArray ba = QByteArray::fromStdString(account.profileInfo.avatar);
140
141 QVariant photo = GlobalInstances::pixmapManipulator().personPhoto(ba, nil);
142 if(QtMac::toNSImage(qvariant_cast<QPixmap>(photo))) {
143 [photoView setBordered:NO];
144 NSImage *image = QtMac::toNSImage(qvariant_cast<QPixmap>(photo));
145 CGFloat newSize = MIN(image.size.height, image.size.width);
146 image = [image cropImageToSize:CGSizeMake(newSize, newSize)];
147 [photoView setImage: [image roundCorners: image.size.height * 0.5]];
148 [addProfilePhotoImage setHidden:YES];
149 } else {
150 [photoView setImage:nil];
151 [photoView setBordered:YES];
152 [addProfilePhotoImage setHidden:NO];
153 }
154 NSString* displayName = @(account.profileInfo.alias.c_str());
155 [displayNameField setStringValue:displayName];
156 [ringIDField setStringValue:@(account.profileInfo.uri.c_str())];
157 if(account.registeredName.empty()) {
158 [registerNameButton setHidden:NO];
159 buttonRegisterWidthConstraint.constant = 260.0;
160 } else {
161 buttonRegisterWidthConstraint.constant = 0.0;
162 [registerNameButton setHidden:YES];
163 }
164
165 [registeredNameField setStringValue:@(account.registeredName.c_str())];
166
167 lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
168 [passwordButton setTitle:accountProperties.archiveHasPassword ? @"Change password" : @"Create password"];
169 self.accountEnabled = account.enabled;
170
171 NSMutableAttributedString *colorTitle = [[NSMutableAttributedString alloc] initWithAttributedString:[removeAccountButton attributedTitle]];
172 NSRange titleRange = NSMakeRange(0, [colorTitle length]);
173 [colorTitle addAttribute:NSForegroundColorAttributeName value:[NSColor errorColor] range:titleRange];
174 [removeAccountButton setAttributedTitle:colorTitle];
175 [devicesTableView reloadData];
176 [blockedContactsTableView reloadData];
177}
178
179-(void) connectSignals {
180 QObject::disconnect(deviceAddedSignal);
181 QObject::disconnect(deviceRevokedSignal);
182 QObject::disconnect(deviceUpdatedSignal);
183 QObject::disconnect(bannedContactsChangedSignal);
184 deviceAddedSignal = QObject::connect(&*(self.accountModel->getAccountInfo(self.selectedAccountID)).deviceModel,
185 &lrc::api::NewDeviceModel::deviceAdded,
186 [self] (const std::string &id) {
187 [devicesTableView reloadData];
188 });
189 deviceRevokedSignal = QObject::connect(&*(self.accountModel->getAccountInfo(self.selectedAccountID)).deviceModel,
190 &lrc::api::NewDeviceModel::deviceRevoked,
191 [self] (const std::string &id, const lrc::api::NewDeviceModel::Status status) {
192 switch (status) {
193 case lrc::api::NewDeviceModel::Status::SUCCESS:
194 [devicesTableView reloadData];
195 break;
196 case lrc::api::NewDeviceModel::Status::WRONG_PASSWORD:
197 [self showAlertWithTitle: @"" andText: @"Device revocation failed with error: Wrong password"];
198 break;
199 case lrc::api::NewDeviceModel::Status::UNKNOWN_DEVICE:
200 [self showAlertWithTitle: @"" andText: @"Device revocation failed with error: Unknown device"];
201 break;
202 }
203 });
204 deviceUpdatedSignal = QObject::connect(&*(self.accountModel->getAccountInfo(self.selectedAccountID)).deviceModel,
205 &lrc::api::NewDeviceModel::deviceUpdated,
206 [self] (const std::string &id) {
207 [devicesTableView reloadData];
208 });
209 bannedContactsChangedSignal = QObject::connect(&*(self.accountModel->getAccountInfo(self.selectedAccountID)).contactModel,
210 &lrc::api::ContactModel::bannedStatusChanged,
211 [self] (const std::string &contactUri, bool banned) {
212 [blockedContactsTableView reloadData];
213 });
214}
215
216-(void) showAlertWithTitle: (NSString *) title andText: (NSString *)text {
217 NSAlert *alert = [[NSAlert alloc] init];
218 [alert addButtonWithTitle:@"OK"];
219 [alert setMessageText:title];
220 [alert setInformativeText:text];
221 [alert runModal];
222}
223
224- (void)pictureTakerDidEnd:(IKPictureTaker *) picker
225 returnCode:(NSInteger) code
226 contextInfo:(void*) contextInfo
227{
228 if (auto outputImage = [picker outputImage]) {
229 auto image = [picker inputImage];
230 CGFloat newSize = MIN(image.size.height, image.size.width);
231 outputImage = [outputImage cropImageToSize:CGSizeMake(newSize, newSize)];
232 [photoView setImage: [outputImage roundCorners: outputImage.size.height * 0.5]];
233 [photoView setBordered:NO];
234 [addProfilePhotoImage setHidden:YES];
235 auto imageToBytes = QByteArray::fromNSData([outputImage TIFFRepresentation]).toBase64();
236 std::string imageToString = std::string(imageToBytes.constData(), imageToBytes.length());
237 self.accountModel->setAvatar(self.selectedAccountID, imageToString);
238 } else if(!photoView.image) {
239 [photoView setBordered:YES];
240 [addProfilePhotoImage setHidden:NO];
241 }
242}
243
244#pragma mark - RegisterNameDelegate methods
245
246- (void) didRegisterName:(NSString *) name withSuccess:(BOOL) success
247{
248 [self.accountModal close];
249 if(!success) {
250 return;
251 }
252
253 if(name.length == 0) {
254 return;
255 }
256 buttonRegisterWidthConstraint.constant = 0.0;
257 [registerNameButton setHidden:YES];
258 [registeredNameField setStringValue:name];
259}
260
261#pragma mark - NSTextFieldDelegate delegate methods
262
263- (void)controlTextDidChange:(NSNotification *)notif
264{
265 NSTextField* textField = [notif object];
266 if (textField.tag != DISPLAYNAME) {
267 return;
268 }
269 NSString* displayName = textField.stringValue;
270
271 [NSObject cancelPreviousPerformRequestsWithTarget:self];
272 self.accountModel->setAlias(self.selectedAccountID, [displayName UTF8String]);
273 lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
274 self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
275}
276
277#pragma mark - NSTableViewDataSource methods
278
279- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
280 if(tableView == devicesTableView) {
281 return self.accountModel->getAccountInfo(self.selectedAccountID).deviceModel->getAllDevices().size();
282 } else if (tableView == blockedContactsTableView){
283 return self.accountModel->getAccountInfo(self.selectedAccountID).contactModel->getBannedContacts().size();
284 }
285 return 0;
286}
287
288#pragma mark - NSTableViewDelegate methods
289- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
290{
291 if(tableView == devicesTableView) {
292 NSTableCellView* deviceView = [tableView makeViewWithIdentifier:@"TableCellDeviceItem" owner:self];
293 NSTextField* nameLabel = [deviceView viewWithTag: DEVICE_NAME_TAG];
294 NSTextField* idLabel = [deviceView viewWithTag: DEVICE_ID_TAG];
295 NSButton* revokeButton = [deviceView viewWithTag: DEVICE_REVOKE_TAG];
296 NSButton* editButton = [deviceView viewWithTag: DEVICE_EDIT_TAG];
297 [editButton setAction:@selector(editDevice:)];
298 [editButton setTarget:self];
299 [revokeButton setAction:@selector(startDeviceRevocation:)];
300 [revokeButton setTarget:self];
301 auto devices = self.accountModel->getAccountInfo(self.selectedAccountID).deviceModel->getAllDevices();
302 auto device = devices.begin();
303
304 std::advance(device, row);
305
306 auto name = device->name;
307 auto deviceID = device->id;
308
309 [nameLabel setStringValue: @(name.c_str())];
310 [idLabel setStringValue: @(deviceID.c_str())];
311 [revokeButton setHidden: device->isCurrent];
312 [editButton setHidden: !device->isCurrent];
313 return deviceView;
314 } else if (tableView == blockedContactsTableView) {
315 NSTableCellView* contactView = [tableView makeViewWithIdentifier:@"TableCellBannedContactItem" owner:self];
316 NSTextField* nameLabel = [contactView viewWithTag: BANNED_CONTACT_NAME_TAG];
317 NSTextField* idLabel = [contactView viewWithTag: BANNED_CONTACT_ID_TAG];
318 NSButton* revokeButton = [contactView viewWithTag: UNBLOCK_CONTACT_TAG];
319 auto contacts = self.accountModel->getAccountInfo(self.selectedAccountID).contactModel->getBannedContacts();
320 auto contactID = contacts.begin();
321 std::advance(contactID, row);
322 [idLabel setStringValue: @(contactID->c_str())];
323 auto contact = self.accountModel->getAccountInfo(self.selectedAccountID).contactModel->getContact([@(contactID->c_str()) UTF8String]);
324 [nameLabel setStringValue: bestNameForContact(contact)];
325 [revokeButton setAction:@selector(unblockContact:)];
326 [revokeButton setTarget:self];
327 return contactView;
328 }
329}
330
331- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row
332{
333 if(tableView == devicesTableView) {
334 return tableView.rowHeight;
335 } else if (tableView == blockedContactsTableView) {
336 CGFloat height = self.bannedContactHeightConstraint.constant;
337 if(height == 150) {
338 return 52;
339 } else {
340 return 1;
341 }
342 }
343}
344
345- (NSTableRowView *)tableView:(NSTableView *)tableView rowViewForRow:(NSInteger)row
346{
347 return [tableView makeViewWithIdentifier:@"HoverRowView" owner:nil];
348}
349
350#pragma mark - Actions
351
352- (IBAction)editPhoto:(id)sender
353{
354 auto pictureTaker = [IKPictureTaker pictureTaker];
355
356 [pictureTaker beginPictureTakerSheetForWindow:[self.view window]
357 withDelegate:self
358 didEndSelector:@selector(pictureTakerDidEnd:returnCode:contextInfo:)
359 contextInfo:nil];
360
361}
362
363- (IBAction)startExportOnRing:(id)sender
364{
365 ExportPasswordWC *passwordWC = [[ExportPasswordWC alloc] initWithNibName:@"ExportPasswordWindow" bundle: nil accountmodel: self.accountModel];
366 passwordWC.selectedAccountID = self.selectedAccountID;
367 accountModal = passwordWC;
368 [self.view.window beginSheet: passwordWC.window completionHandler:nil];
369}
370- (IBAction)triggerAdwancedSettings: (NSButton *)sender {
371 [self.delegate triggerAdvancedOptions];
372}
373
374- (IBAction)enableAccount: (NSButton *)sender {
375 const auto& account = accountModel->getAccountInfo(self.selectedAccountID);
376 self.accountModel->enableAccount(self.selectedAccountID, !account.enabled);
377 self.accountEnabled = account.enabled;
378 lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
379 self.accountModel->setAccountConfig(self.selectedAccountID, accountProperties);
380}
381
382- (IBAction)removeAccount:(id)sender
383{
384 NSAlert *alert = [[NSAlert alloc] init];
385 [alert addButtonWithTitle:@"OK"];
386 [alert addButtonWithTitle:@"Cancel"];
387 [alert setMessageText: NSLocalizedString(@"Remove account",
388 @"Remove account alert title")];
389 [alert setInformativeText:NSLocalizedString(@"By clicking \"OK\" you will remove this account on this device! This action can not be undone. Also, your registered name can be lost.",
390 @"Remove account alert message")];
391
392 if ([alert runModal] == NSAlertFirstButtonReturn) {
393 self.accountModel->removeAccount(self.selectedAccountID);
394 }
395}
396
397- (IBAction)exportAccount:(id)sender
398{
399 BackupAccountWC* passwordWC = [[BackupAccountWC alloc] initWithNibName:@"BackupAccountWindow" bundle: nil accountmodel: self.accountModel];
400 passwordWC.delegate = self;
401 [passwordWC setAllowFileSelection:NO];
Kateryna Kostiuk14366812018-08-24 16:30:20 -0400402 passwordWC.selectedAccountID = self.selectedAccountID;
Kateryna Kostiuk1f8c1252018-07-30 18:18:57 -0400403 accountModal = passwordWC;
404 [self.view.window beginSheet:passwordWC.window completionHandler:nil];
405}
406
407- (IBAction)startNameRegistration:(id)sender
408{
409 RegisterNameWC* registerWC = [[RegisterNameWC alloc] initWithNibName:@"RegisterNameWindow" bundle: nil accountmodel: self.accountModel];
410 registerWC.delegate = self;
411 registerWC.selectedAccountID = self.selectedAccountID;
412 self.accountModal = registerWC;
413 [self.view.window beginSheet:registerWC.window completionHandler:nil];
414}
415- (IBAction)changePassword:(id)sender
416{
417 PasswordChangeWC* passwordWC = [[PasswordChangeWC alloc] initWithNibName:@"PasswordChange" bundle: nil accountmodel: self.accountModel];
418 passwordWC.selectedAccountID = self.selectedAccountID;
419 passwordWC.delegate = self;
420 [self.view.window beginSheet:passwordWC.window completionHandler:nil];
421 self.passwordModal = passwordWC;
422}
423
424- (IBAction)showBanned: (NSButton *)sender {
425 CGFloat height = self.bannedContactHeightConstraint.constant;
426 NSRect frame = self.view.frame;
427 if(height == 150) {
428 frame.size.height = frame.size.height - 150 - 10;
429 } else {
430 frame.size.height = frame.size.height + 150 + 10;
431 }
432 self.view.frame = frame;
433 [self.delegate updateFrame];
434 CGFloat advancedHeight = self.advancedButtonMarginConstraint.constant;
435 self.advancedButtonMarginConstraint.constant = (height== 2) ? 40 : 30;
436 self.bannedContactHeightConstraint.constant = (height== 2) ? 150 : 2;
437 [[[self.blockedContactsTableView superview] superview] setHidden:![[[self.blockedContactsTableView superview] superview] isHidden]];
438 [blockedContactsTableView reloadData];
439}
440
441-(void) hideBannedContacts {
442 CGFloat height = self.bannedContactHeightConstraint.constant;
443 NSRect frame = self.view.frame;
444 if(height == 150) {
445 [self showBanned:nil];
446 }
447}
448
449- (IBAction)startDeviceRevocation:(NSView*)sender
450{
451 NSInteger row = [devicesTableView rowForView:sender];
452 if(row < 0) {
453 return;
454 }
455 auto devices = self.accountModel->getAccountInfo(self.selectedAccountID).deviceModel->getAllDevices();
456 auto device = devices.begin();
457 std::advance(device, row);
458 if(device == devices.end()) {
459 return;
460 }
461 [self proceedDeviceRevokationAlert:device->id];
462}
463
464- (IBAction)unblockContact:(NSView*)sender
465{
466 NSInteger row = [blockedContactsTableView rowForView:sender];
467 if(row < 0) {
468 return;
469 }
470 auto contacts = self.accountModel->getAccountInfo(self.selectedAccountID).contactModel->getBannedContacts();
471 auto contactID = contacts.begin();
472 std::advance(contactID, row);
473 if(contactID == contacts.end()) {
474 return;
475 }
476 auto contact = self.accountModel->getAccountInfo(self.selectedAccountID).contactModel->getContact([@(contactID->c_str()) UTF8String]);
477 if(!contact.isBanned) {
478 return;
479 }
480 self.accountModel->getAccountInfo(self.selectedAccountID).contactModel->addContact(contact);
481}
482
483- (IBAction)editDevice:(NSView*)sender
484{
485 NSInteger row = [devicesTableView rowForView:sender];
486 if(row < 0) {
487 return;
488 }
489
490 NSTableCellView* deviceView = [devicesTableView viewAtColumn:0 row:row makeIfNecessary:NO];
491 if(!deviceView || ![deviceView isKindOfClass:[NSTableCellView class]]) {
492 return;
493 }
494
495 NSTextField* nameLabel = [deviceView viewWithTag: DEVICE_NAME_TAG];
496 NSButton* editButton = [deviceView viewWithTag: DEVICE_EDIT_TAG];
497 if ([nameLabel isEditable]) {
498 self.accountModel->getAccountInfo(self.selectedAccountID).deviceModel->setCurrentDeviceName([nameLabel.stringValue UTF8String]);
499 [nameLabel setEditable:NO];
500 [self.view.window makeFirstResponder:nil];
501 editButton.image = [NSImage imageNamed:NSImageNameTouchBarComposeTemplate];
502 return;
503 }
504 [nameLabel setEditable:YES];
505 [nameLabel becomeFirstResponder];
506 editButton.image = [NSImage imageNamed:NSImageNameTouchBarDownloadTemplate];
507}
508
509-(void) revokeDeviceWithID: (std::string) deviceID password:(NSString *) password {
510 self.accountModel->getAccountInfo(self.selectedAccountID).deviceModel->revokeDevice(deviceID, [password UTF8String]);
511}
512
513-(void) proceedDeviceRevokationAlert: (std::string) deviceID {
514 NSAlert *alert = [[NSAlert alloc] init];
515 [alert addButtonWithTitle:@"OK"];
516 [alert addButtonWithTitle:@"Cancel"];
517 [alert setMessageText:@"Revoke Device"];
518 [alert setInformativeText:@"Attention! This action could not be undone!"];
519 lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
520 if(accountProperties.archiveHasPassword) {
521 NSSecureTextField *passwordText = [[NSSecureTextField alloc] initWithFrame:NSMakeRect(0, 0, 200, 24)];
522 [passwordText setPlaceholderString:@"Enter password"];
523 [alert setAccessoryView:passwordText];
524 if ([alert runModal] == NSAlertFirstButtonReturn) {
525 [self revokeDeviceWithID:deviceID password:[passwordText stringValue]];
526 }
527 } else {
528 if ([alert runModal] == NSAlertFirstButtonReturn) {
529 [self revokeDeviceWithID:deviceID password:@""];
530 }
531 }
532}
533
534#pragma mark - BackupAccountDelegate methods
535
536-(void) didCompleteExportWithPath:(NSURL*) fileUrl
537{
538 [[NSWorkspace sharedWorkspace] selectFile:fileUrl.path inFileViewerRootedAtPath:@""];
539}
540
541#pragma mark - PasswordChangeDelegate
542
543-(void) paswordCreatedWithSuccess:(BOOL) success
544{
545 [passwordButton setTitle: success ? @"Change password" : @"Create password"];
546}
547
548@end