forked from DotNetOpenAuth/DotNetOpenAuth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAccountMembershipService.cs
40 lines (33 loc) · 1.13 KB
/
AccountMembershipService.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
namespace OpenIdProviderMvc.Code {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
public class AccountMembershipService : IMembershipService {
private MembershipProvider provider;
public AccountMembershipService()
: this(null) {
}
public AccountMembershipService(MembershipProvider provider) {
this.provider = provider ?? Membership.Provider;
}
public int MinPasswordLength {
get {
return this.provider.MinRequiredPasswordLength;
}
}
public bool ValidateUser(string userName, string password) {
return this.provider.ValidateUser(userName, password);
}
public MembershipCreateStatus CreateUser(string userName, string password, string email) {
MembershipCreateStatus status;
this.provider.CreateUser(userName, password, email, null, null, true, null, out status);
return status;
}
public bool ChangePassword(string userName, string oldPassword, string newPassword) {
MembershipUser currentUser = this.provider.GetUser(userName, true /* userIsOnline */);
return currentUser.ChangePassword(oldPassword, newPassword);
}
}
}