def signup_seller(self, account_info, connection): account_dao = AccountDao() is_existing_email = account_dao.find_account(account_info, connection) if is_existing_email: raise Exception('EXISTING_EMAIL') is_kr_name_taken = account_dao.find_seller_name_kr_exist( account_info, connection) if is_kr_name_taken: raise Exception('EXISTING_KR_NAME') is_en_name_taken = account_dao.find_seller_name_en_exist( account_info, connection) if is_en_name_taken: raise Exception('EXISTING_EN_NAME') bcrypt_password = bcrypt.hashpw( account_info['password'].encode('utf-8'), bcrypt.gensalt()) account_info['password'] = bcrypt_password signed_up_account = account_dao.create_account(account_info, connection) account_info['account_id'] = signed_up_account account_info['editor_id'] = signed_up_account account_info['is_active'] = 1 account_info['profile_pic_url'] = '' account_info['short_desc'] = '' account_info['long_desc'] = '' account_info['close_time'] = '' account_info['open_time'] = '' account_info['delivery_policy'] = '' account_info['return_policy'] = '' account_info['zip_code'] = '' account_info['address_1'] = '' account_info['address_2'] = '' account_info['is_open_weekend'] = '' account_dao.create_account_log(account_info, connection) signed_up_seller = account_dao.create_seller(account_info, connection) account_info['seller_id'] = signed_up_seller account_dao.create_seller_log(account_info, connection) return signed_up_seller
def signup_account(self, account_info, connection): account_dao = AccountDao() is_existing_email = account_dao.find_account(account_info, connection) if is_existing_email: raise Exception('EXISTING_EMAIL') bcrypt_password = bcrypt.hashpw( account_info['password'].encode('utf-8'), bcrypt.gensalt()) account_info['password'] = bcrypt_password signed_up_id = account_dao.create_account(account_info, connection) account_info['account_id'] = signed_up_id account_info['editor_id'] = signed_up_id account_info['is_active'] = 1 account_dao.create_account_log(account_info, connection) return signed_up_id