Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Riina Antikainen
/
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 8f71ece1
authored
May 15, 2014
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check that user-object is not null when creating user from invite.
1 parent
eff35ee1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/UserBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/UserBean.java
View file @
8f71ece
...
@@ -477,8 +477,9 @@ public class UserBean implements UserBeanLocal {
...
@@ -477,8 +477,9 @@ public class UserBean implements UserBeanLocal {
@Override
@Override
@RolesAllowed
(
UserPermission
.
S_INVITE_USERS
)
@RolesAllowed
(
UserPermission
.
S_INVITE_USERS
)
public
boolean
invite
(
String
invitemail
,
String
url
)
{
public
boolean
invite
(
String
invitemail
,
String
url
)
{
invitemail
=
invitemail
.
trim
();
List
<
User
>
usercheck
=
userFacade
.
findByEmail
(
invitemail
.
trim
()
);
List
<
User
>
usercheck
=
userFacade
.
findByEmail
(
invitemail
);
if
(
usercheck
.
size
()
>
0
)
{
if
(
usercheck
.
size
()
>
0
)
{
return
false
;
return
false
;
}
}
...
@@ -486,7 +487,7 @@ public class UserBean implements UserBeanLocal {
...
@@ -486,7 +487,7 @@ public class UserBean implements UserBeanLocal {
LanEvent
ev
=
eventBean
.
getCurrentEvent
();
LanEvent
ev
=
eventBean
.
getCurrentEvent
();
PlaceGroup
pg
=
new
PlaceGroup
(
ev
,
Calendar
.
getInstance
(),
Calendar
.
getInstance
(),
false
);
PlaceGroup
pg
=
new
PlaceGroup
(
ev
,
Calendar
.
getInstance
(),
Calendar
.
getInstance
(),
false
);
pg
.
setCreator
(
creator
);
pg
.
setCreator
(
creator
);
pg
.
setName
(
"Invite
bean"
);
pg
.
setName
(
"Invite
to "
+
invitemail
);
String
token
=
PasswordFunctions
.
generateRandomString
(
30
,
PasswordFunctions
.
ALL_CHARS
);
String
token
=
PasswordFunctions
.
generateRandomString
(
30
,
PasswordFunctions
.
ALL_CHARS
);
pg
.
getMembers
().
add
(
new
GroupMembership
(
pg
,
null
,
token
));
pg
.
getMembers
().
add
(
new
GroupMembership
(
pg
,
null
,
token
));
pgfacade
.
create
(
pg
);
pgfacade
.
create
(
pg
);
...
@@ -526,6 +527,8 @@ public class UserBean implements UserBeanLocal {
...
@@ -526,6 +527,8 @@ public class UserBean implements UserBeanLocal {
@Override
@Override
@PermitAll
@PermitAll
public
boolean
createFromInviteToken
(
EventUser
user
,
String
token
)
{
public
boolean
createFromInviteToken
(
EventUser
user
,
String
token
)
{
if
(
user
==
null
||
user
.
getLogin
()
==
null
)
return
false
;
GroupMembership
gm
=
findToken
(
token
);
GroupMembership
gm
=
findToken
(
token
);
// Check that invite has not already been accepted!
// Check that invite has not already been accepted!
if
(
gm
==
null
||
gm
.
getUser
()
!=
null
||
gm
.
getInviteAccepted
()
!=
null
)
{
if
(
gm
==
null
||
gm
.
getUser
()
!=
null
||
gm
.
getInviteAccepted
()
!=
null
)
{
...
...
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