1 | using System;
|
---|
2 | using System.Web.Security;
|
---|
3 |
|
---|
4 | namespace Persistence {
|
---|
5 | partial class HeuristicLabUser : MembershipUser {
|
---|
6 | public override bool ChangePassword(string oldPassword, string newPassword) {
|
---|
7 | if (oldPassword == null) {
|
---|
8 | throw new ArgumentNullException("oldPassword");
|
---|
9 | }
|
---|
10 | if (newPassword == null) {
|
---|
11 | throw new ArgumentNullException("newPassword");
|
---|
12 | }
|
---|
13 | if (oldPassword.Length == 0) {
|
---|
14 | throw new ArgumentException("Parameter oldPassword must not be empty!");
|
---|
15 | }
|
---|
16 | if (newPassword.Length == 0) {
|
---|
17 | throw new ArgumentException("Parameter newPassword must not be empty!");
|
---|
18 | }
|
---|
19 |
|
---|
20 | if (Password.CompareTo(oldPassword) == 0) {
|
---|
21 | Password = newPassword;
|
---|
22 | return true;
|
---|
23 | } else {
|
---|
24 | return false;
|
---|
25 | }
|
---|
26 | }
|
---|
27 |
|
---|
28 | public override bool ChangePasswordQuestionAndAnswer(string password, string newPasswordQuestion, string newPasswordAnswer) {
|
---|
29 | if (password == null) {
|
---|
30 | throw new ArgumentNullException("password");
|
---|
31 | }
|
---|
32 | if (newPasswordQuestion == null) {
|
---|
33 | throw new ArgumentNullException("newPasswordQuestion");
|
---|
34 | }
|
---|
35 | if (newPasswordAnswer == null) {
|
---|
36 | throw new ArgumentNullException("newPasswordAnswer");
|
---|
37 | }
|
---|
38 | if (password.Length == 0) {
|
---|
39 | throw new ArgumentException("Parameter password must not be empty!");
|
---|
40 | }
|
---|
41 | if (newPasswordQuestion.Length == 0) {
|
---|
42 | throw new ArgumentException("Parameter newPasswordQuestion must not be empty!");
|
---|
43 | }
|
---|
44 | if (newPasswordAnswer.Length == 0) {
|
---|
45 | throw new ArgumentException("Parameter newPasswordAnswer must not be empty!");
|
---|
46 | }
|
---|
47 |
|
---|
48 | if (Password.CompareTo(password) == 0) {
|
---|
49 | _PasswordQuestion = newPasswordQuestion;
|
---|
50 | PasswordAnswer = newPasswordAnswer;
|
---|
51 | return true;
|
---|
52 | } else {
|
---|
53 | return false;
|
---|
54 | }
|
---|
55 | }
|
---|
56 |
|
---|
57 | public override string GetPassword() {
|
---|
58 | return Password;
|
---|
59 | }
|
---|
60 |
|
---|
61 | //
|
---|
62 | // Summary:
|
---|
63 | // Gets the password for the membership user from the membership data store.
|
---|
64 | //
|
---|
65 | // Parameters:
|
---|
66 | // passwordAnswer:
|
---|
67 | // The password answer for the membership user.
|
---|
68 | //
|
---|
69 | // Returns:
|
---|
70 | // The password for the membership user.
|
---|
71 | public override string GetPassword(string passwordAnswer) {
|
---|
72 | throw new NotImplementedException();
|
---|
73 | }
|
---|
74 |
|
---|
75 | //
|
---|
76 | // Summary:
|
---|
77 | // Resets a user's password to a new, automatically generated password.
|
---|
78 | //
|
---|
79 | // Returns:
|
---|
80 | // The new password for the membership user.
|
---|
81 | public override string ResetPassword() {
|
---|
82 | throw new NotImplementedException();
|
---|
83 | }
|
---|
84 |
|
---|
85 | //
|
---|
86 | // Summary:
|
---|
87 | // Resets a user's password to a new, automatically generated password.
|
---|
88 | //
|
---|
89 | // Parameters:
|
---|
90 | // passwordAnswer:
|
---|
91 | // The password answer for the membership user.
|
---|
92 | //
|
---|
93 | // Returns:
|
---|
94 | // The new password for the membership user.
|
---|
95 | public override string ResetPassword(string passwordAnswer) {
|
---|
96 | throw new NotImplementedException();
|
---|
97 | }
|
---|
98 |
|
---|
99 | public override string ToString() {
|
---|
100 | return UserName;
|
---|
101 | }
|
---|
102 |
|
---|
103 | //
|
---|
104 | // Summary:
|
---|
105 | // Clears the locked-out state of the user so that the membership user can be
|
---|
106 | // validated.
|
---|
107 | //
|
---|
108 | // Returns:
|
---|
109 | // true if the membership user was successfully unlocked; otherwise, false.
|
---|
110 | public override bool UnlockUser() {
|
---|
111 | throw new NotImplementedException();
|
---|
112 | }
|
---|
113 | }
|
---|
114 | }
|
---|