require('templates/configform.php');
}
+ public static function createuserlisener(){
+ if(isset($_POST['new_username']) and isset($_POST['new_password'])){
+ if(OC_USER::createuser($_POST['new_username'],$_POST['new_password'])){
+ return 'user successfully created';
+ }else{
+ return 'error while trying to create user';
+ }
+ }else{
+ return false;
+ }
+ }
+
/**
* lisen for configuration changes and write it to the file
*
*
*/
public static function loginlisener(){
- global $CONFIG_ADMINLOGIN;
- global $CONFIG_ADMINPASSWORD;
if(isset($_POST['loginbutton']) and isset($_POST['password']) and isset($_POST['login'])){
if(OC_USER::login($_POST['login'],$_POST['password'])){
OC_LOG::event($_SESSION['username'],1,'');
return('');
}
+
/**
* try to create a new user
*
return true;
}
}
+
+ public static function generatepassword(){
+ return uniqid();
+ }
}
?>
\ No newline at end of file
if(!isset($fillDB)) $fillDB=true;
if(!isset($CONFIG_DBHOST)) $CONFIG_DBHOST='localhost';
if(!isset($CONFIG_DBUSER)) $CONFIG_DBUSER='owncloud';
+$newuserpassword=OC_USER::generatepassword();
?>
<script type="text/javascript">
function showDBAdmin(){
<tr id='dbAdminPwd'><td>database administrative password:</td><td><input type="password" name="dbadminpwd" size="30" class="formstyle" value=''></input></td></tr>
<tr><td>automaticly fill initial database:</td><td><input type="checkbox" name="filldb" size="30" class="formstyle" value='1' <?php if($FIRSTRUN) echo 'checked'; ?>></input></td></tr>
<tr><td></td><td><input type="submit" name="set_config" alt="save" value="save" class="formstyle" /></td></tr>
-</table></form>
+</table></form><br/>
+<br/>
+<form method="post" enctype="multipart/form-data">
+<table cellpadding="5" cellspacing="5" border="0" class="loginform">
+<tr><td colspan='2'>Create new user:</td></tr>
+<tr><td>user name</td><td><input type='text' name='new_username' class="formstyle"></input></td></tr>
+<tr><td>password</td><td><input type='text' name='new_password' class="formstyle" autocomplete="off" value='<?php echo($newuserpassword);?>'></input></td></tr>
+<tr><td></td><td><input type='submit' value='create' class="formstyle"></input></td></tr>
+</table>
+</form>
<script type="text/javascript">
dbtypechange()
</script>
\ No newline at end of file
// check if already configured. otherwise start configuration wizard
$error=OC_CONFIG::writeconfiglisener();
+ if($e=OC_CONFIG::createuserlisener()){
+ $error=$e;
+ }
$CONFIG_ERROR=$error;
global $CONFIG_INSTALLED;
if(!$CONFIG_INSTALLED) {