1 | using System;
|
---|
2 | using System.Linq;
|
---|
3 | using System.Web.Security;
|
---|
4 | using Persistence;
|
---|
5 |
|
---|
6 | namespace Service.Provider {
|
---|
7 | class HeuristicLabMembershipProvider : MembershipProvider {
|
---|
8 | public override string ApplicationName {
|
---|
9 | get {
|
---|
10 | throw new NotImplementedException();
|
---|
11 | }
|
---|
12 | set {
|
---|
13 | throw new NotImplementedException();
|
---|
14 | }
|
---|
15 | }
|
---|
16 |
|
---|
17 | public override bool ChangePassword(string username, string oldPassword, string newPassword) {
|
---|
18 | DataClassesDataContext db = DatabaseUtil.createDataClassesDataContext();
|
---|
19 | if (db == null) {
|
---|
20 | return false;
|
---|
21 | }
|
---|
22 | try {
|
---|
23 | HeuristicLabUser u = db.HeuristicLabUsers.Single(x => x.UserName == username);
|
---|
24 | if (u.ChangePassword(oldPassword, newPassword)) {
|
---|
25 | db.SubmitChanges();
|
---|
26 | return true;
|
---|
27 | } else {
|
---|
28 | return false;
|
---|
29 | }
|
---|
30 | }
|
---|
31 | catch (Exception) {
|
---|
32 | return false;
|
---|
33 | }
|
---|
34 | }
|
---|
35 |
|
---|
36 | public override bool ChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer) {
|
---|
37 | DataClassesDataContext db = DatabaseUtil.createDataClassesDataContext();
|
---|
38 | if (db == null) {
|
---|
39 | return false;
|
---|
40 | }
|
---|
41 | try {
|
---|
42 | HeuristicLabUser u = db.HeuristicLabUsers.Single(x => x.UserName == username);
|
---|
43 | if (u.ChangePasswordQuestionAndAnswer(password, newPasswordQuestion, newPasswordAnswer)) {
|
---|
44 | db.SubmitChanges();
|
---|
45 | return true;
|
---|
46 | } else {
|
---|
47 | return false;
|
---|
48 | }
|
---|
49 | }
|
---|
50 | catch (Exception) {
|
---|
51 | return false;
|
---|
52 | }
|
---|
53 | }
|
---|
54 |
|
---|
55 | public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) {
|
---|
56 | throw new NotImplementedException();
|
---|
57 | }
|
---|
58 |
|
---|
59 | public override bool DeleteUser(string username, bool deleteAllRelatedData) {
|
---|
60 | throw new NotImplementedException();
|
---|
61 | }
|
---|
62 |
|
---|
63 | public override bool EnablePasswordReset {
|
---|
64 | get { throw new NotImplementedException(); }
|
---|
65 | }
|
---|
66 |
|
---|
67 | public override bool EnablePasswordRetrieval {
|
---|
68 | get { throw new NotImplementedException(); }
|
---|
69 | }
|
---|
70 |
|
---|
71 | public override MembershipUserCollection FindUsersByEmail(string emailToMatch, int pageIndex, int pageSize, out int totalRecords) {
|
---|
72 | throw new NotImplementedException();
|
---|
73 | }
|
---|
74 |
|
---|
75 | public override MembershipUserCollection FindUsersByName(string usernameToMatch, int pageIndex, int pageSize, out int totalRecords) {
|
---|
76 | throw new NotImplementedException();
|
---|
77 | }
|
---|
78 |
|
---|
79 | public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords) {
|
---|
80 | throw new NotImplementedException();
|
---|
81 | }
|
---|
82 |
|
---|
83 | public override int GetNumberOfUsersOnline() {
|
---|
84 | throw new NotImplementedException();
|
---|
85 | }
|
---|
86 |
|
---|
87 | public override string GetPassword(string username, string answer) {
|
---|
88 | throw new NotImplementedException();
|
---|
89 | }
|
---|
90 |
|
---|
91 | public override MembershipUser GetUser(string username, bool userIsOnline) {
|
---|
92 | throw new NotImplementedException();
|
---|
93 | }
|
---|
94 |
|
---|
95 | public override MembershipUser GetUser(object providerUserKey, bool userIsOnline) {
|
---|
96 | throw new NotImplementedException();
|
---|
97 | }
|
---|
98 |
|
---|
99 | public override string GetUserNameByEmail(string email) {
|
---|
100 | throw new NotImplementedException();
|
---|
101 | }
|
---|
102 |
|
---|
103 | public override int MaxInvalidPasswordAttempts {
|
---|
104 | get { throw new NotImplementedException(); }
|
---|
105 | }
|
---|
106 |
|
---|
107 | public override int MinRequiredNonAlphanumericCharacters {
|
---|
108 | get { throw new NotImplementedException(); }
|
---|
109 | }
|
---|
110 |
|
---|
111 | public override int MinRequiredPasswordLength {
|
---|
112 | get { throw new NotImplementedException(); }
|
---|
113 | }
|
---|
114 |
|
---|
115 | public override int PasswordAttemptWindow {
|
---|
116 | get { throw new NotImplementedException(); }
|
---|
117 | }
|
---|
118 |
|
---|
119 | public override MembershipPasswordFormat PasswordFormat {
|
---|
120 | get { throw new NotImplementedException(); }
|
---|
121 | }
|
---|
122 |
|
---|
123 | public override string PasswordStrengthRegularExpression {
|
---|
124 | get { throw new NotImplementedException(); }
|
---|
125 | }
|
---|
126 |
|
---|
127 | public override bool RequiresQuestionAndAnswer {
|
---|
128 | get { throw new NotImplementedException(); }
|
---|
129 | }
|
---|
130 |
|
---|
131 | public override bool RequiresUniqueEmail {
|
---|
132 | get { throw new NotImplementedException(); }
|
---|
133 | }
|
---|
134 |
|
---|
135 | public override string ResetPassword(string username, string answer) {
|
---|
136 | throw new NotImplementedException();
|
---|
137 | }
|
---|
138 |
|
---|
139 | public override bool UnlockUser(string userName) {
|
---|
140 | throw new NotImplementedException();
|
---|
141 | }
|
---|
142 |
|
---|
143 | public override void UpdateUser(MembershipUser user) {
|
---|
144 | throw new NotImplementedException();
|
---|
145 | }
|
---|
146 |
|
---|
147 | public override bool ValidateUser(string username, string password) {
|
---|
148 | throw new NotImplementedException();
|
---|
149 | }
|
---|
150 | }
|
---|
151 | }
|
---|