Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
07a8992a
Commit
07a8992a
authored
14 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
admins can now create new users
parent
6b5bd813
No related branches found
Branches containing commit
No related tags found
Loading
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
inc/lib_config.php
+12
-0
12 additions, 0 deletions
inc/lib_config.php
inc/lib_user.php
+5
-2
5 additions, 2 deletions
inc/lib_user.php
inc/templates/configform.php
+11
-1
11 additions, 1 deletion
inc/templates/configform.php
inc/templates/header.php
+3
-0
3 additions, 0 deletions
inc/templates/header.php
with
31 additions
and
3 deletions
inc/lib_config.php
+
12
−
0
View file @
07a8992a
...
...
@@ -14,6 +14,18 @@ class OC_CONFIG{
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
*
...
...
This diff is collapsed.
Click to expand it.
inc/lib_user.php
+
5
−
2
View file @
07a8992a
...
...
@@ -32,8 +32,6 @@ class OC_USER {
*
*/
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
,
''
);
...
...
@@ -45,6 +43,7 @@ class OC_USER {
return
(
''
);
}
/**
* try to create a new user
*
...
...
@@ -192,6 +191,10 @@ class OC_USER {
return
true
;
}
}
public
static
function
generatepassword
(){
return
uniqid
();
}
}
?>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
inc/templates/configform.php
+
11
−
1
View file @
07a8992a
...
...
@@ -4,6 +4,7 @@ global $CONFIG_ERROR;
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
(){
...
...
@@ -82,7 +83,16 @@ if($CONFIG_DBTYPE=='sqlite'){
<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
This diff is collapsed.
Click to expand it.
inc/templates/header.php
+
3
−
0
View file @
07a8992a
...
...
@@ -33,6 +33,9 @@ echo('<h1><a id="owncloud-logo" href="'.$WEBROOT.'"><span>ownCloud</span></a></h
// 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
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment