def create_account(self): """ Creates an account from provided form. Verify we can unlock it. Disables widgets during the process, so the user doesn't try to create another account during the process. """ # circular ref from pywallet.controller import Controller self.toggle_widgets(False) if not self.verify_fields(): Dialog.show_invalid_form_dialog() self.toggle_widgets(True) return pywalib = self.controller.pywalib password = self.new_password1 security_ratio = self.security_slider_value # dividing again by 10, because otherwise it's # too slow on smart devices security_ratio /= 10.0 Dialog.snackbar_message("Creating account...") account = pywalib.new_account(password=password, security_ratio=security_ratio) Dialog.snackbar_message("Created!") self.toggle_widgets(True) Controller.set_account_alias(account, self.alias) self.on_account_created(account) CreateNewAccount.try_unlock(account, password) self.show_redirect_dialog() self.controller.load_landing_page() return account
def update_password(self): """ Update account password with new password provided. """ if not self.verify_fields(): Dialog.show_invalid_form_dialog() return Dialog.snackbar_message("Verifying current password...") if not self.verify_current_password_field(): Dialog.snackbar_message("Wrong account password") return pywalib = self.controller.pywalib account = self.current_account new_password = self.new_password1 Dialog.snackbar_message("Updating account...") pywalib.update_account_password(account, new_password=new_password) Dialog.snackbar_message("Updated!")
def on_send_click(self): if not self.verify_fields(): Dialog.show_invalid_form_dialog() return dialog = self.prompt_password_dialog() dialog.open()