Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
c943f485
Commit
c943f485
authored
13 years ago
by
Marvin Thomas Rabe
Browse files
Options
Downloads
Patches
Plain Diff
fixed link to password recovery. removed duplicated and unused code out of index.php.
parent
0514a192
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/templates/login.php
+4
-10
4 additions, 10 deletions
core/templates/login.php
index.php
+33
-34
33 additions, 34 deletions
index.php
with
37 additions
and
44 deletions
core/templates/login.php
+
4
−
10
View file @
c943f485
<form
action=
"index.php"
method=
"post"
>
<fieldset>
<?php
if
(
$_
[
'error'
])
:
?>
<a
href=
"index.php?lostpassword"
>
<?php
echo
$l
->
t
(
'Lost your password?'
);
?>
</a>
<?php
endif
;
?>
<?php
if
(
empty
(
$_
[
'username'
]))
:
?>
<input
type=
"text"
name=
"user"
id=
"user"
placeholder=
"
<?php
echo
$l
->
t
(
'Username'
);
?>
"
value=
"
<?php
echo
!
empty
(
$_POST
[
'user'
])
?
$_POST
[
'user'
]
.
'"'
:
'" autofocus'
;
?>
autocomplete="
off
"
required
/>
<input
type=
"password"
name=
"password"
id=
"password"
placeholder=
"
<?php
echo
$l
->
t
(
'Password'
);
?>
"
value=
""
required
<?php
echo
!
empty
(
$_POST
[
'user'
])
?
'autofocus'
:
''
;
?>
/>
<input
type=
"checkbox"
name=
"remember_login"
value=
"1"
id=
"remember_login"
/><label
for=
"remember_login"
>
<?php
echo
$l
->
t
(
'remember'
);
?>
</label>
<?php
else
:
?>
<input
type=
"text"
name=
"user"
id=
"user"
placeholder=
"
<?php
echo
$l
->
t
(
'Username'
);
?>
"
value=
"
<?php
echo
$_
[
'username'
];
?>
"
autocomplete=
"off"
required
>
<input
type=
"password"
name=
"password"
id=
"password"
placeholder=
"
<?php
echo
$l
->
t
(
'Password'
);
?>
"
value=
""
required
autofocus
/>
<input
type=
"checkbox"
name=
"remember_login"
value=
"1"
id=
"remember_login"
checked
/><label
for=
"remember_login"
>
<?php
echo
$l
->
t
(
'remember'
);
?>
</label>
<a
href=
"./lostpassword/"
>
<?php
echo
$l
->
t
(
'Lost your password?'
);
?>
</a>
<?php
endif
;
?>
<input
type=
"text"
name=
"user"
id=
"user"
placeholder=
"
<?php
echo
$l
->
t
(
'Username'
);
?>
"
value=
"
<?php
echo
!
empty
(
$_POST
[
'user'
])
?
$_POST
[
'user'
]
.
'"'
:
'" autofocus'
;
?>
autocomplete="
off
"
required
/>
<input
type=
"password"
name=
"password"
id=
"password"
placeholder=
"
<?php
echo
$l
->
t
(
'Password'
);
?>
"
value=
""
required
<?php
echo
!
empty
(
$_POST
[
'user'
])
?
'autofocus'
:
''
;
?>
/>
<input
type=
"checkbox"
name=
"remember_login"
value=
"1"
id=
"remember_login"
/><label
for=
"remember_login"
>
<?php
echo
$l
->
t
(
'remember'
);
?>
</label>
<input
type=
"submit"
id=
"submit"
class=
"login"
value=
"
<?php
echo
$l
->
t
(
'Log in'
);
?>
"
/>
</fieldset>
</form>
This diff is collapsed.
Click to expand it.
index.php
+
33
−
34
View file @
c943f485
...
...
@@ -52,44 +52,43 @@ elseif(OC_User::isLoggedIn()) {
}
}
//
remember was checked after last login
else
if
(
isset
(
$_COOKIE
[
"oc_remember_login"
])
&&
isset
(
$_COOKIE
[
"oc_token"
])
&&
isset
(
$_COOKIE
[
"oc_username"
])
&&
$_COOKIE
[
"oc_remember_login"
])
{
//
For all others cases, we display the guest page :
else
{
OC_App
::
loadApps
();
if
(
defined
(
"DEBUG"
)
&&
DEBUG
)
{
error_log
(
"Trying to login from cookie"
);}
// confirm credentials in cookie
if
(
isset
(
$_COOKIE
[
'oc_token'
])
&&
OC_User
::
userExists
(
$_COOKIE
[
'oc_username'
])
&&
OC_Preferences
::
getValue
(
$_COOKIE
[
'oc_username'
],
"login"
,
"token"
)
==
$_COOKIE
[
'oc_token'
])
{
OC_User
::
setUserId
(
$_COOKIE
[
'oc_username'
]);
OC_Util
::
redirectToDefaultPage
();
}
else
{
OC_Util
::
displayLoginPage
(
array
(
'error'
=>
true
));
}
}
$error
=
false
;
// Someone wants to log in :
elseif
(
isset
(
$_POST
[
"user"
])
&&
isset
(
$_POST
[
'password'
]))
{
OC_App
::
loadApps
();
if
(
OC_User
::
login
(
$_POST
[
"user"
],
$_POST
[
"password"
]))
{
if
(
!
empty
(
$_POST
[
"remember_login"
])){
if
(
defined
(
"DEBUG"
)
&&
DEBUG
)
{
error_log
(
"Setting remember login to cookie"
);}
$token
=
md5
(
$_POST
[
"user"
]
.
time
());
OC_Preferences
::
setValue
(
$_POST
[
'user'
],
'login'
,
'token'
,
$token
);
OC_User
::
setMagicInCookie
(
$_POST
[
"user"
],
$token
);
// remember was checked after last login
if
(
isset
(
$_COOKIE
[
"oc_remember_login"
])
&&
isset
(
$_COOKIE
[
"oc_token"
])
&&
isset
(
$_COOKIE
[
"oc_username"
])
&&
$_COOKIE
[
"oc_remember_login"
])
{
if
(
defined
(
"DEBUG"
)
&&
DEBUG
)
{
error_log
(
"Trying to login from cookie"
);
}
else
{
OC_User
::
unsetMagicInCookie
();
// confirm credentials in cookie
if
(
isset
(
$_COOKIE
[
'oc_token'
])
&&
OC_User
::
userExists
(
$_COOKIE
[
'oc_username'
])
&&
OC_Preferences
::
getValue
(
$_COOKIE
[
'oc_username'
],
"login"
,
"token"
)
==
$_COOKIE
[
'oc_token'
])
{
OC_User
::
setUserId
(
$_COOKIE
[
'oc_username'
]);
OC_Util
::
redirectToDefaultPage
();
}
}
// Someone wants to log in :
elseif
(
isset
(
$_POST
[
"user"
])
&&
isset
(
$_POST
[
'password'
]))
{
if
(
OC_User
::
login
(
$_POST
[
"user"
],
$_POST
[
"password"
]))
{
if
(
!
empty
(
$_POST
[
"remember_login"
])){
if
(
defined
(
"DEBUG"
)
&&
DEBUG
)
{
error_log
(
"Setting remember login to cookie"
);
}
$token
=
md5
(
$_POST
[
"user"
]
.
time
());
OC_Preferences
::
setValue
(
$_POST
[
'user'
],
'login'
,
'token'
,
$token
);
OC_User
::
setMagicInCookie
(
$_POST
[
"user"
],
$token
);
}
else
{
OC_User
::
unsetMagicInCookie
();
}
OC_Util
::
redirectToDefaultPage
();
}
else
{
$error
=
true
;
}
OC_Util
::
redirectToDefaultPage
();
}
else
{
OC_Util
::
displayLoginPage
(
array
(
'error'
=>
true
));
}
}
// For all others cases, we display the guest page :
else
{
OC_App
::
loadApps
();
OC_Util
::
displayLoginPage
(
array
(
'error'
=>
false
));
OC_Template
::
printGuestPage
(
''
,
'login'
,
array
(
'error'
=>
$error
));
}
?>
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