This repository has been archived by the owner on Oct 18, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
src/Subtext.Framework/Services/Security/HostAccountService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#region Disclaimer/Info | ||
|
||
/////////////////////////////////////////////////////////////////////////////////////////////////// | ||
// Subtext WebLog | ||
// | ||
// Subtext is an open source weblog system that is a fork of the .TEXT | ||
// weblog system. | ||
// | ||
// For updated news and information please visit http://subtextproject.com/ | ||
// Subtext is hosted at Google Code at http://code.google.com/p/subtext/ | ||
// The development mailing list is at subtext@googlegroups.com | ||
// | ||
// This project is licensed under the BSD license. See the License.txt file for more information. | ||
/////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
#endregion | ||
|
||
using Subtext.Framework.Configuration; | ||
using Subtext.Framework.Providers; | ||
|
||
namespace Subtext.Framework.Security | ||
{ | ||
public class HostAccountService : AccountService | ||
{ | ||
ObjectRepository _repository; | ||
HostInfo _hostInfo; | ||
|
||
public HostAccountService(HostInfo hostInfo, ISubtextContext context) | ||
: base(context) | ||
{ | ||
_repository = context.Repository; | ||
_hostInfo = hostInfo; | ||
} | ||
|
||
public override void UpdatePassword(string password) | ||
{ | ||
_hostInfo.Password = Config.Settings.UseHashedPasswords ? SecurityHelper.HashPassword(password, _hostInfo.Salt) : password; | ||
HostInfo.UpdateHost(_repository, _hostInfo); | ||
} | ||
|
||
public bool IsValidPassword(string password) | ||
{ | ||
return IsValidPassword(password, _hostInfo.Password, Config.Settings.UseHashedPasswords, _hostInfo.Salt); | ||
} | ||
} | ||
} |