Added code for initial login create through LSP
This commit is contained in:
parent
ae29894737
commit
e3e76758b7
1 changed files with 12 additions and 0 deletions
|
@ -86,6 +86,18 @@ namespace Controller {
|
||||||
conn.Authorized = false;
|
conn.Authorized = false;
|
||||||
Response["authorize"]["status"] = "CHALL";
|
Response["authorize"]["status"] = "CHALL";
|
||||||
Response["authorize"]["challenge"] = Challenge;
|
Response["authorize"]["challenge"] = Challenge;
|
||||||
|
//the following is used to add the first account through the LSP
|
||||||
|
if (!Storage["account"]){
|
||||||
|
Response["authorize"]["status"] = "NOACC";
|
||||||
|
if (Request["authorize"]["new_username"] && Request["authorize"]["new_password"]){
|
||||||
|
//create account
|
||||||
|
Controller::Log("CONF", "Created account " + Request["authorize"]["new_username"].asString() + " through API");
|
||||||
|
Controller::Storage["account"][Request["authorize"]["new_username"].asString()]["password"] = Secure::md5(Request["authorize"]["new_password"].asString());
|
||||||
|
Response["authorize"]["status"] = "ACC_MADE";
|
||||||
|
}else{
|
||||||
|
Response["authorize"].removeMember("challenge");
|
||||||
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue