public static PasswordsService Instance()
        {
            if (_instance == null)
            {
                _instance = new PasswordsService();
            }

            return(_instance);
        }
Пример #2
0
 /// <summary>
 /// Login the User.
 /// </summary>
 /// <param name="user">User to be Login.</param>
 /// <returns>User: The logged in User.</returns>
 public Users LoginUser(Users user)
 {
     if (ValidationService.Instance().User(user))
     {
         Users UserFromDB = UsersData.Instance().LoginUser(user);
         if (ValidationService.Instance().User(UserFromDB) && PasswordsService.Instance().IsSame(UserFromDB.Master, user.Master))
         {
             return(UserFromDB);
         }
         else
         {
             return(null);
         }
     }
     else
     {
         return(null);
     }
 }
Пример #3
0
 /// <summary>
 /// Login the User.
 /// </summary>
 /// <param name="user">User to be Login.</param>
 /// <returns>User: The logged in User.</returns>
 public Task <User> LoginUserAsync(User user)
 {
     return(Task.Factory.StartNew(() =>
     {
         if (ValidationService.Instance().User(user))
         {
             User UserFromDB = UsersData.Instance().LoginUser(user);
             if (ValidationService.Instance().User(UserFromDB) && PasswordsService.Instance().IsSame(UserFromDB.Master, user.Master))
             {
                 return PopulateUserData(UserFromDB);
             }
             else
             {
                 return null;
             }
         }
         else
         {
             return null;
         }
     }));
 }