Exemplo n.º 1
0
        private Response SetLogin(Request req)
        {
            if (req.TryDecrypt())
            {
                var eu        = new EntryUpdate();
                var reqMsg    = req.Message;
                var url       = reqMsg.GetString("url");
                var uuid      = reqMsg.GetString("uuid");
                var login     = reqMsg.GetString("login");
                var pw        = reqMsg.GetString("password");
                var submitUrl = reqMsg.GetString("submitUrl");
                var groupUuid = reqMsg.GetString("groupUuid");

                bool result;

                if (string.IsNullOrEmpty(uuid))
                {
                    result = eu.CreateEntry(login, pw, url, submitUrl, null, groupUuid);
                }
                else
                {
                    result = eu.UpdateEntry(uuid, login, pw, url);
                }

                var resp = req.GetResponse();

                resp.Message.Add("count", JValue.CreateNull());
                resp.Message.Add("entries", JValue.CreateNull());
                resp.Message.Add("error", result ? "success" : "error");

                return(resp);
            }
            return(new ErrorResponse(req, ErrorType.CannotDecryptMessage));
        }
Exemplo n.º 2
0
        private Response SetLogin(Request req)
        {
            if (req.TryDecrypt())
            {
                var eu        = new EntryUpdate();
                var reqMsg    = req.Message;
                var url       = reqMsg.GetString("url");
                var uuid      = reqMsg.GetString("uuid");
                var login     = reqMsg.GetString("login");
                var pw        = reqMsg.GetString("password");
                var submitUrl = reqMsg.GetString("submitUrl");

                if (string.IsNullOrEmpty(uuid))
                {
                    eu.CreateEntry(login, pw, url, submitUrl, null);
                }
                else
                {
                    eu.UpdateEntry(uuid, login, pw, url);
                }

                return(req.GetResponse());
            }
            return(new ErrorResponse(req, ErrorType.CannotDecryptMessage));
        }