diff --git a/Common/dataobjects/Account.cs b/Common/dataobjects/Account.cs index 4946e31..f7aca96 100644 --- a/Common/dataobjects/Account.cs +++ b/Common/dataobjects/Account.cs @@ -133,6 +133,21 @@ namespace FLocal.Common.dataobjects { } public void updatePassword(string newPassword) { + ChangeSetUtil.ApplyChanges(new AbstractChange[] { + new UpdateChange( + TableSpec.instance, + new Dictionary() { + { + TableSpec.FIELD_PASSWORDHASH, + new ScalarFieldValue(this.hashPassword(newPassword)) + }, + }, + this.id + ) + }); + } + + public void migrate(string newPassword) { ChangeSetUtil.ApplyChanges(new AbstractChange[] { new UpdateChange( TableSpec.instance, @@ -147,6 +162,13 @@ namespace FLocal.Common.dataobjects { }, }, this.id + ), + new UpdateChange( + User.TableSpec.instance, + new Dictionary { + { User.TableSpec.FIELD_SHOWPOSTSTOUSERS, new ScalarFieldValue(User.ENUM_SHOWPOSTSTOUSERS_ALL) }, + }, + this.user.id ) }); } diff --git a/IISMainHandler/handlers/request/MigrateAccountHandler.cs b/IISMainHandler/handlers/request/MigrateAccountHandler.cs index 2a9ab1d..1b75aa4 100644 --- a/IISMainHandler/handlers/request/MigrateAccountHandler.cs +++ b/IISMainHandler/handlers/request/MigrateAccountHandler.cs @@ -28,6 +28,17 @@ namespace FLocal.IISHandler.handlers.request { } protected override XElement[] Do(WebContext context) { + + if(context.httprequest.Form["constitution"] != "constitution") { + throw new FLocalException("constitution not accepted"); + } + if(context.httprequest.Form["showPostsToAll"] != "showPostsToAll") { + throw new FLocalException("publicity not accepted"); + } + if(context.httprequest.Form["law"] != "law") { + throw new FLocalException("laws not accepted"); + } + Account account = Account.LoadById(int.Parse(context.httprequest.Form["accountId"])); if(!account.needsMigration) throw new FLocalException("Already migrated"); string userInfo = ShallerGateway.getUserInfoAsString(account.user.name); diff --git a/templates/Full/MigrateAccount.xslt b/templates/Full/MigrateAccount.xslt index b63eb07..96ed3df 100644 --- a/templates/Full/MigrateAccount.xslt +++ b/templates/Full/MigrateAccount.xslt @@ -31,6 +31,21 @@
Повторите пароль

+
+ + + конституция + . + (обязательно) +
+ + + (обязательно) +
+ +