Ejemplo n.º 1
0
        public async Task<ApiToken> Login(string email, string password)
        {
            var response = new ApiToken();
            var login = await UserManager.FindAsync(email, password);

            if (login != null)
            {
                response.Status = true;
                response.AuthtnicationToken = Guid.NewGuid().ToString();
                JRApiSession.Create(response, login, CurrentIp);
                return response;
            }
            return response;
        }
Ejemplo n.º 2
0
        public static JRSession Create(ApiToken token, JRUser user, string ip)
        {
            var session = new JRSession
            {
                UserId = user.Id,
                Created = DateTime.Now,
                LastRequest = DateTime.Now,
                SessionId = token.AuthtnicationToken,
                Ip = ip,
                Data = new Dictionary<string, object>()
            };

            Sessions.Add(session);
            return session;
        }