Agreement on migration

main
Inga 🏳‍🌈 14 years ago
parent 916202f317
commit 591cc365a2
  1. 22
      Common/dataobjects/Account.cs
  2. 11
      IISMainHandler/handlers/request/MigrateAccountHandler.cs
  3. 15
      templates/Full/MigrateAccount.xslt

@ -133,6 +133,21 @@ namespace FLocal.Common.dataobjects {
}
public void updatePassword(string newPassword) {
ChangeSetUtil.ApplyChanges(new AbstractChange[] {
new UpdateChange(
TableSpec.instance,
new Dictionary<string, AbstractFieldValue>() {
{
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<string, AbstractFieldValue> {
{ User.TableSpec.FIELD_SHOWPOSTSTOUSERS, new ScalarFieldValue(User.ENUM_SHOWPOSTSTOUSERS_ALL) },
},
this.user.id
)
});
}

@ -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);

@ -31,6 +31,21 @@
<input type="password" name="password" class="formboxes" /><br/>
<xsl:text>Ïîâòîðèòå ïàðîëü</xsl:text><br/>
<input type="password" name="password2" class="formboxes" /><br/>
<br/>
<input type="checkbox" name="constitution" value="constitution"/>
<label for="constitution"> Да, я согласен с тем, что на этом форуме действует</label>
<a href="/q/consitution/">конституция</a>
<xsl:text>.</xsl:text>
<i> (обязательно)</i>
<br/>
<input type="checkbox" name="showPostsToAll" value="showPostsToAll"/>
<label for="showPostsToAll">Да, я согласен с тем, чтобы мои сообщения, размещённые на этом форуме или на форум.локале (форумбгз.ру), были доступны публично.</label>
<i> (обязательно)</i>
<br/>
<input type="checkbox" name="law" value="law"/>
<label for="law">Да, я обязуюсь соблюдать законы Российской Федерации и Федеративной Республики Германия в общении на этом форуме.</xsl:text>
<i> (обязательно)</i>
<br/>
<input type="submit" name="buttlogin" value="Ìèãðèðîâàòü!" class="buttons" />
</form>
</td>

Loading…
Cancel
Save