예제 #1
0
        public DataRespond login(User user, string lang)
        {
            DataRespond data = new DataRespond();
            User        us   = getUser(user);

            if (us is null)
            {
                data.success = false;
                data.message = m_translate.loadJsonLogin(lang).usernotexist;
                return(data);
            }
            if (checkUser(user))
            {
                data.success = true;
                data.data    = new { token = genToken(us), user = us };
                data.message = m_translate.loadJsonLogin(lang).loginsuccess;
            }
            else
            {
                data.success = false;
                data.message = m_translate.loadJsonLogin(lang).passwordnotcorrect;
            }
            return(data);
        }