diff --git a/Builder/IISMainHandler/build.txt b/Builder/IISMainHandler/build.txt index 930e0e0..1c8a8a8 100644 --- a/Builder/IISMainHandler/build.txt +++ b/Builder/IISMainHandler/build.txt @@ -1 +1 @@ -930 \ No newline at end of file +932 \ No newline at end of file diff --git a/IISMainHandler/handlers/request/RegisterByInviteHandler.cs b/IISMainHandler/handlers/request/RegisterByInviteHandler.cs index 5ea8638..993f794 100644 --- a/IISMainHandler/handlers/request/RegisterByInviteHandler.cs +++ b/IISMainHandler/handlers/request/RegisterByInviteHandler.cs @@ -14,6 +14,14 @@ namespace FLocal.IISHandler.handlers.request { class RegisterByInviteHandler : AbstractNewAccountHandler { protected override Account DoCreateAccount(WebContext context) { + try { + Account tmpAccount = Account.LoadByName(context.httprequest.Form["login"]); + if(tmpAccount.needsMigration) { + throw new RedirectException("/MigrateAccount/" + context.httprequest.Form["login"]); + } + } catch(NotFoundInDBException) { + } + Invite invite = Invite.LoadById(int.Parse(context.httprequest.Form["inviteId"])); if(invite.isUsed) throw new FLocalException("Invite is already used"); if(context.httprequest.Form["password"] != context.httprequest.Form["password2"]) throw new FLocalException("Passwords mismatch"); diff --git a/IISMainHandler/handlers/request/RegisterHandler.cs b/IISMainHandler/handlers/request/RegisterHandler.cs index 00295b0..696c824 100644 --- a/IISMainHandler/handlers/request/RegisterHandler.cs +++ b/IISMainHandler/handlers/request/RegisterHandler.cs @@ -14,6 +14,14 @@ namespace FLocal.IISHandler.handlers.request { class RegisterHandler : AbstractNewAccountHandler { protected override Account DoCreateAccount(WebContext context) { + try { + Account tmpAccount = Account.LoadByName(context.httprequest.Form["login"]); + if(tmpAccount.needsMigration) { + throw new RedirectException("/MigrateAccount/" + context.httprequest.Form["login"]); + } + } catch(NotFoundInDBException) { + } + if(!LocalNetwork.IsLocalNetwork(context.remoteHost)) throw new FLocalException("IP '" + context.remoteHost.ToString() + "' is not allowed"); if(context.httprequest.Form["password"] != context.httprequest.Form["password2"]) throw new FLocalException("Passwords mismatch"); return Account.createAccount(context.httprequest.Form["login"], context.httprequest.Form["password"], context.httprequest.UserHostAddress, context.httprequest.Form["registrationEmail"]);