Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor 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
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
9fd1b716
Commit
9fd1b716
authored
9 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
OO-1715: show an error message instead of a red screen
parent
1752f339
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
src/main/java/org/olat/login/auth/OLATAuthManager.java
+7
-1
7 additions, 1 deletion
src/main/java/org/olat/login/auth/OLATAuthManager.java
src/main/java/org/olat/registration/PwChangeController.java
+16
-3
16 additions, 3 deletions
src/main/java/org/olat/registration/PwChangeController.java
with
23 additions
and
4 deletions
src/main/java/org/olat/login/auth/OLATAuthManager.java
+
7
−
1
View file @
9fd1b716
...
@@ -106,8 +106,14 @@ public class OLATAuthManager extends BasicManager implements AuthenticationSPI {
...
@@ -106,8 +106,14 @@ public class OLATAuthManager extends BasicManager implements AuthenticationSPI {
// check for email instead of username if ident is null
// check for email instead of username if ident is null
if
(
loginModule
.
isAllowLoginUsingEmail
())
{
if
(
loginModule
.
isAllowLoginUsingEmail
())
{
if
(
MailHelper
.
isValidEmailAddress
(
login
)){
if
(
MailHelper
.
isValidEmailAddress
(
login
)){
ident
=
userManager
.
findIdentit
y
ByEmail
(
login
);
List
<
Identity
>
identities
=
userManager
.
findIdentit
ies
ByEmail
(
Collections
.
singletonList
(
login
)
)
;
// check for email changed with verification workflow
// check for email changed with verification workflow
if
(
identities
.
size
()
==
1
)
{
ident
=
identities
.
get
(
0
);
}
else
if
(
identities
.
size
()
>
1
)
{
logError
(
"more than one identity found with email::"
+
login
,
null
);
}
if
(
ident
==
null
)
{
if
(
ident
==
null
)
{
ident
=
findIdentInChangingEmailWorkflow
(
login
);
ident
=
findIdentInChangingEmailWorkflow
(
login
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/org/olat/registration/PwChangeController.java
+
16
−
3
View file @
9fd1b716
...
@@ -26,7 +26,9 @@
...
@@ -26,7 +26,9 @@
package
org.olat.registration
;
package
org.olat.registration
;
import
java.text.DateFormat
;
import
java.text.DateFormat
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Locale
;
import
org.olat.basesecurity.Authentication
;
import
org.olat.basesecurity.Authentication
;
...
@@ -83,6 +85,8 @@ public class PwChangeController extends BasicController {
...
@@ -83,6 +85,8 @@ public class PwChangeController extends BasicController {
@Autowired
@Autowired
private
RegistrationManager
rm
;
private
RegistrationManager
rm
;
@Autowired
private
UserManager
userManager
;
/**
/**
* Controller to change a user's password.
* Controller to change a user's password.
...
@@ -167,6 +171,7 @@ public class PwChangeController extends BasicController {
...
@@ -167,6 +171,7 @@ public class PwChangeController extends BasicController {
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
* org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
*/
@Override
public
void
event
(
UserRequest
ureq
,
Controller
source
,
Event
event
)
{
public
void
event
(
UserRequest
ureq
,
Controller
source
,
Event
event
)
{
if
(
source
==
pwf
)
{
if
(
source
==
pwf
)
{
// pwchange Form was clicked
// pwchange Form was clicked
...
@@ -179,9 +184,14 @@ public class PwChangeController extends BasicController {
...
@@ -179,9 +184,14 @@ public class PwChangeController extends BasicController {
pwchangeHomelink
.
setCustomEnabledLinkCSS
(
"btn btn-primary"
);
pwchangeHomelink
.
setCustomEnabledLinkCSS
(
"btn btn-primary"
);
//pwf.setVisible(false);
//pwf.setVisible(false);
pwarea
.
setVisible
(
false
);
pwarea
.
setVisible
(
false
);
Identity
identToChange
=
U
serManager
.
getInstance
().
findIdentit
y
ByEmail
(
tempKey
.
getEmailAddress
());
List
<
Identity
>
identToChange
s
=
u
serManager
.
findIdentit
ies
ByEmail
(
Collections
.
singletonList
(
tempKey
.
getEmailAddress
())
)
;
if
(
identToChange
==
null
||
!
pwf
.
saveFormData
(
identToChange
)
)
{
if
(
identToChange
s
==
null
||
identToChanges
.
size
()
==
0
||
identToChange
s
.
size
()
>
1
)
{
getWindowControl
().
setError
(
translate
(
"pwchange.failed"
));
getWindowControl
().
setError
(
translate
(
"pwchange.failed"
));
}
else
{
Identity
identToChange
=
identToChanges
.
get
(
0
);
if
(!
pwf
.
saveFormData
(
identToChange
))
{
getWindowControl
().
setError
(
translate
(
"pwchange.failed"
));
}
}
}
rm
.
deleteTemporaryKeyWithId
(
tempKey
.
getRegistrationKey
());
rm
.
deleteTemporaryKeyWithId
(
tempKey
.
getRegistrationKey
());
}
else
if
(
event
==
Event
.
CANCELLED_EVENT
)
{
}
else
if
(
event
==
Event
.
CANCELLED_EVENT
)
{
...
@@ -213,7 +223,10 @@ public class PwChangeController extends BasicController {
...
@@ -213,7 +223,10 @@ public class PwChangeController extends BasicController {
// Try fallback with email, maybe user used his email address instead
// Try fallback with email, maybe user used his email address instead
// only do this, if its really an email, may lead to multiple results else.
// only do this, if its really an email, may lead to multiple results else.
if
(
MailHelper
.
isValidEmailAddress
(
emailOrUsername
))
{
if
(
MailHelper
.
isValidEmailAddress
(
emailOrUsername
))
{
identity
=
UserManager
.
getInstance
().
findIdentityByEmail
(
emailOrUsername
);
List
<
Identity
>
identities
=
userManager
.
findIdentitiesByEmail
(
Collections
.
singletonList
(
emailOrUsername
));
if
(
identities
.
size
()
==
1
)
{
identity
=
identities
.
get
(
0
);
}
}
}
}
}
if
(
identity
!=
null
)
{
if
(
identity
!=
null
)
{
...
...
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