Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Linnea Samila
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 8bea3338
authored
Oct 25, 2012
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Loosen usercreate stuff for admins
1 parent
84e77079
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
11 deletions
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserValidator.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserValidator.java
View file @
8bea333
...
@@ -14,7 +14,9 @@ import javax.inject.Named;
...
@@ -14,7 +14,9 @@ import javax.inject.Named;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
fi.insomnia.bortal.beans.PermissionBeanLocal
;
import
fi.insomnia.bortal.beans.UserBeanLocal
;
import
fi.insomnia.bortal.beans.UserBeanLocal
;
import
fi.insomnia.bortal.enums.apps.UserPermission
;
import
fi.insomnia.bortal.utilities.I18n
;
import
fi.insomnia.bortal.utilities.I18n
;
@Named
@Named
...
@@ -29,12 +31,15 @@ public class UserValidator implements Serializable {
...
@@ -29,12 +31,15 @@ public class UserValidator implements Serializable {
private
static
final
Integer
PASSWORD_MIN_LENGTH
=
8
;
private
static
final
Integer
PASSWORD_MIN_LENGTH
=
8
;
@EJB
@EJB
private
transient
UserBeanLocal
userbean
;
private
transient
UserBeanLocal
userbean
;
@EJB
private
transient
PermissionBeanLocal
permbean
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
UserValidator
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
UserValidator
.
class
);
public
void
validateEmail
(
FacesContext
context
,
UIComponent
ui
,
Object
value
)
{
public
void
validateEmail
(
FacesContext
context
,
UIComponent
ui
,
Object
value
)
{
String
email
=
(
String
)
value
;
String
email
=
(
String
)
value
;
if
(
email
.
indexOf
(
'@'
)
==
-
1
)
{
if
(
!
permbean
.
hasPermission
(
UserPermission
.
MODIFY
)
&&
email
.
indexOf
(
'@'
)
==
-
1
)
{
message
(
context
,
ui
,
"userview.invalidEmail"
);
message
(
context
,
ui
,
"userview.invalidEmail"
);
}
}
}
}
...
@@ -53,17 +58,20 @@ public class UserValidator implements Serializable {
...
@@ -53,17 +58,20 @@ public class UserValidator implements Serializable {
public
void
password
(
FacesContext
context
,
UIComponent
ui
,
Object
object
)
{
public
void
password
(
FacesContext
context
,
UIComponent
ui
,
Object
object
)
{
logger
.
info
(
"Executing pwd, firstpwd {}"
,
firstpwd
);
logger
.
info
(
"Executing pwd, firstpwd {}"
,
firstpwd
);
if
(
object
==
null
)
{
if
(!
permbean
.
hasPermission
(
UserPermission
.
MODIFY
))
message
(
context
,
ui
,
"user.passwordlengthMessage"
);
{
return
;
if
(
object
==
null
)
{
}
message
(
context
,
ui
,
"user.passwordlengthMessage"
);
if
(
firstpwd
==
null
)
{
return
;
firstpwd
=
object
.
toString
();
}
if
(
PASSWORD_MIN_LENGTH
.
compareTo
(
firstpwd
.
length
())
>
0
)
{
if
(
firstpwd
==
null
)
{
message
(
context
,
ui
,
"userview.passwordTooShort"
,
PASSWORD_MIN_LENGTH
);
firstpwd
=
object
.
toString
();
if
(
PASSWORD_MIN_LENGTH
.
compareTo
(
firstpwd
.
length
())
>
0
)
{
message
(
context
,
ui
,
"userview.passwordTooShort"
,
PASSWORD_MIN_LENGTH
);
}
logger
.
info
(
"Setting firstpwd to {} as {}"
,
firstpwd
,
object
.
getClass
());
return
;
}
}
logger
.
info
(
"Setting firstpwd to {} as {}"
,
firstpwd
,
object
.
getClass
());
return
;
}
}
logger
.
info
(
"Checking length"
);
logger
.
info
(
"Checking length"
);
if
(!
firstpwd
.
equals
(
object
))
{
if
(!
firstpwd
.
equals
(
object
))
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment