Advertisement
Guest User

Untitled

a guest
Jul 18th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.81 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using WS = Pdta.WebAdminClient.AdminService;
  6.  
  7. namespace Pdta.WebAdminClient {
  8.   public class WSMembershipProvider : System.Web.Security.MembershipProvider {
  9.  
  10.     private WS.AdminService adminService = new WS.AdminService();
  11.  
  12.  
  13.     public override string ApplicationName {
  14.       get {
  15.         throw new NotImplementedException();
  16.       }
  17.       set {
  18.         throw new NotImplementedException();
  19.       }
  20.     }
  21.  
  22.     public override bool ChangePassword(string username, string oldPassword, string newPassword) {
  23.       throw new NotImplementedException();
  24.     }
  25.  
  26.     public override bool ChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer) {
  27.       throw new NotImplementedException();
  28.     }
  29.  
  30.     public override System.Web.Security.MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out System.Web.Security.MembershipCreateStatus status) {
  31.       throw new NotImplementedException();
  32.     }
  33.  
  34.     public override bool DeleteUser(string username, bool deleteAllRelatedData) {
  35.       throw new NotImplementedException();
  36.     }
  37.  
  38.     public override bool EnablePasswordReset {
  39.       get { throw new NotImplementedException(); }
  40.     }
  41.  
  42.     public override bool EnablePasswordRetrieval {
  43.       get { throw new NotImplementedException(); }
  44.     }
  45.  
  46.     public override System.Web.Security.MembershipUserCollection FindUsersByEmail(string emailToMatch, int pageIndex, int pageSize, out int totalRecords) {
  47.       throw new NotImplementedException();
  48.     }
  49.  
  50.     public override System.Web.Security.MembershipUserCollection FindUsersByName(string usernameToMatch, int pageIndex, int pageSize, out int totalRecords) {
  51.       throw new NotImplementedException();
  52.     }
  53.  
  54.     public override System.Web.Security.MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords) {
  55.       throw new NotImplementedException();
  56.     }
  57.  
  58.     public override int GetNumberOfUsersOnline() {
  59.       throw new NotImplementedException();
  60.     }
  61.  
  62.     public override string GetPassword(string username, string answer) {
  63.       throw new NotImplementedException();
  64.     }
  65.  
  66.     public override System.Web.Security.MembershipUser GetUser(string username, bool userIsOnline) {
  67.       throw new NotImplementedException();
  68.     }
  69.  
  70.     public override System.Web.Security.MembershipUser GetUser(object providerUserKey, bool userIsOnline) {
  71.       throw new NotImplementedException();
  72.     }
  73.  
  74.     public override string GetUserNameByEmail(string email) {
  75.       throw new NotImplementedException();
  76.     }
  77.  
  78.     public override int MaxInvalidPasswordAttempts {
  79.       get { throw new NotImplementedException(); }
  80.     }
  81.  
  82.     public override int MinRequiredNonAlphanumericCharacters {
  83.       get { throw new NotImplementedException(); }
  84.     }
  85.  
  86.     public override int MinRequiredPasswordLength {
  87.       get { throw new NotImplementedException(); }
  88.     }
  89.  
  90.     public override int PasswordAttemptWindow {
  91.       get { throw new NotImplementedException(); }
  92.     }
  93.  
  94.     public override System.Web.Security.MembershipPasswordFormat PasswordFormat {
  95.       get { throw new NotImplementedException(); }
  96.     }
  97.  
  98.     public override string PasswordStrengthRegularExpression {
  99.       get { throw new NotImplementedException(); }
  100.     }
  101.  
  102.     public override bool RequiresQuestionAndAnswer {
  103.       get { throw new NotImplementedException(); }
  104.     }
  105.  
  106.     public override bool RequiresUniqueEmail {
  107.       get { throw new NotImplementedException(); }
  108.     }
  109.  
  110.     public override string ResetPassword(string username, string answer) {
  111.       throw new NotImplementedException();
  112.     }
  113.  
  114.     public override bool UnlockUser(string userName) {
  115.       throw new NotImplementedException();
  116.     }
  117.  
  118.     public override void UpdateUser(System.Web.Security.MembershipUser user) {
  119.       throw new NotImplementedException();
  120.     }
  121.  
  122.     /// <summary>
  123.     /// Verifies that the specified user name and password exist in the data source.
  124.     /// </summary>
  125.     /// <param name="username">The name of the user to validate.</param>
  126.     /// <param name="password">The password for the specified user.</param>
  127.     /// <returns>
  128.     /// true if the specified username and password are valid; otherwise, false.
  129.     /// </returns>
  130.     public override bool ValidateUser(string username, string password) {
  131.       try {
  132.         bool result = adminService.ValidateUser(new WS.Credentials { Username = username, Password = password });
  133.         if(result) HttpContext.Current.Session["Password"] = password;
  134.         return result;
  135.       } catch (Exception) {
  136.         return false;
  137.       }
  138.      
  139.     }
  140.  
  141.  
  142.  
  143.   }
  144. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement