|
|
@ -14,6 +14,14 @@ namespace FLocal.IISHandler.handlers.request { |
|
|
|
class RegisterHandler : AbstractNewAccountHandler { |
|
|
|
class RegisterHandler : AbstractNewAccountHandler { |
|
|
|
|
|
|
|
|
|
|
|
protected override Account DoCreateAccount(WebContext context) { |
|
|
|
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(!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"); |
|
|
|
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"]); |
|
|
|
return Account.createAccount(context.httprequest.Form["login"], context.httprequest.Form["password"], context.httprequest.UserHostAddress, context.httprequest.Form["registrationEmail"]); |
|
|
|