def create_pincard(uid): new_pincard = save_pincard(uid) self.emit('pincardManager:newpincard', { 'key': 'pincardManager:newpincard', 'data': new_pincard })
def post(self, request, command, user): with self._handle_exception(request): if (command == 'create'): response_data = save_pincard(user) logger.debug('Created new pincard for user with ' 'uid ({}).'.format(user)) if (command == 'reset'): uid = request.data.get('uid') pinlist = request.data.get('pinlist') reset_response, reset_status = reset_password( user, uid, pinlist) response_data = { 'response': reset_response, 'status': reset_status } logger.debug('Received password reset request for ' 'user ({}).'.format(user)) return Response(response_data) e_msg = ('Unsupported command ({}). Valid commands are ' 'create, reset.').format(command) handle_exception(Exception(e_msg), request)
def post(self, request, command, user): with self._handle_exception(request): if (command == 'create'): response_data = save_pincard(user) logger.debug('Created new pincard for user with uid %s' % user) if (command == 'reset'): uid = request.data.get('uid') pinlist = request.data.get('pinlist') reset_response, reset_status = reset_password(user, uid, pinlist) response_data = {'response': reset_response, 'status': reset_status} logger.debug('Received password reset request for user %s' % user) return Response(response_data) e_msg = ('Unsupported command(%s). Valid commands are create, reset' % command) handle_exception(Exception(e_msg), request)
def post(self, request, command, user): with self._handle_exception(request): if command == "create": response_data = save_pincard(user) logger.debug("Created new pincard for user with uid ({}).".format(user)) if command == "reset": uid = request.data.get("uid") pinlist = request.data.get("pinlist") reset_response, reset_status = reset_password(user, uid, pinlist) response_data = {"response": reset_response, "status": reset_status} logger.debug( "Received password reset request for user ({}).".format(user) ) return Response(response_data) e_msg = ("Unsupported command ({}). Valid commands are create, reset.").format( command ) handle_exception(Exception(e_msg), request)
def create_pincard(uid): new_pincard = save_pincard(uid) self.emit('pincardManager:newpincard', {'key': 'pincardManager:newpincard', 'data': new_pincard})