def set_password(self, login, new_password): """Change the logged in user's password. Arguments: login -- the user's current login information. Should be an ordrin.data.UserLogin object new_password -- the new password (in plain text) """ data = {'email': login.email, 'password': UserLogin.hash_password(new_password), 'previous_password': login.password} return self._call_api('PUT', ('u', login.email, 'password'), login=login, data=data)
def order_create_user(self, restaurant_id, tray, tip, delivery_date_time, first_name, last_name, address, credit_card, email, password): """Place an order and create a user account Arguments: restaurant_id -- Ordr.in's restaurant identifier tray -- A tray of food to order. Should be an ordrin.data.Tray object tip -- The tip amount delivery_date_time -- Either 'ASAP' or a datetime object in the future first_name -- The orderer's first name last_name -- The orderer's last name address -- An address object (ordrin.data.Address) or the nickname of a saved address credit_card -- A credit card object (ordrin.data.CreditCard) or the nickname of a saved credit card email -- The email address of the user password -- The user's password (in plain text) """ data = self._build_dict(restaurant_id, tray, tip, delivery_date_time, first_name, last_name, address, credit_card, email) data['pw'] = UserLogin.hash_password(password) return self._call_api('POST', ('o', restaurant_id), data=data)