Пример #1
0
        public ActionResult LoginInfo(int?id)
        {
            var ret = AuthenticateDeveloper();

            if (ret.StartsWith("!"))
            {
                return(Content($"<LoginInfo error=\"{ret.Substring(1)}\" />"));
            }
            if (!id.HasValue)
            {
                return(Content("<LoginInfo error=\"Missing id\" />"));
            }
            var p   = DbUtil.Db.People.Single(pp => pp.PeopleId == id);
            var api = new APIFunctions(DbUtil.Db);

            return(Content(api.Login(p), "text/xml"));
        }
Пример #2
0
        public ActionResult Login(string user, string password)
        {
            var ret = AuthenticateDeveloper();

            if (ret.StartsWith("!"))
            {
                return(Content("<Login error=\"{0}\" />".Fmt(ret.Substring(1))));
            }
            var o = AccountModel.AuthenticateLogon(user, password, Request.Url.OriginalString);

            if (o is string)
            {
                return(Content("<Login error=\"{0} not valid\">{1}</Login>".Fmt(user ?? "(null)", o)));
            }
            var u   = o as User;
            var api = new APIFunctions(DbUtil.Db);

            return(Content(api.Login(u.Person), "text/xml"));
        }
Пример #3
0
        public ActionResult Login(string user, string password)
        {
            var ret = AuthenticateDeveloper();

            if (ret.StartsWith("!"))
            {
                return(Content($"<Login error=\"{ret.Substring(1)}\" />"));
            }

            var validationStatus = AccountModel.AuthenticateLogon(user, password, Request.Url.OriginalString);

            if (!validationStatus.IsValid)
            {
                return(Content($"<Login error=\"{user ?? "(null)"} not valid\">{validationStatus.ErrorMessage}</Login>"));
            }

            var api = new APIFunctions(DbUtil.Db);

            return(Content(api.Login(validationStatus.User.Person), "text/xml"));
        }