From 591cc365a25406411777d9e9077f9098eb51aa99 Mon Sep 17 00:00:00 2001 From: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Sun, 4 Jul 2010 07:28:02 +0000 Subject: [PATCH] Agreement on migration --- Common/dataobjects/Account.cs | 22 +++++++++++++++++++ .../handlers/request/MigrateAccountHandler.cs | 11 ++++++++++ templates/Full/MigrateAccount.xslt | 15 +++++++++++++ 3 files changed, 48 insertions(+) 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 @@
Повторите пароль

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