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 b68a5c2d
authored
Oct 25, 2014
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stuff
1 parent
e788d87d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
14 deletions
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/BootstrapBeanLocal.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/BootstrapBean.java
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/user/AuthView.java
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/BootstrapBeanLocal.java
View file @
b68a5c2
...
@@ -23,5 +23,6 @@ import javax.ejb.Local;
...
@@ -23,5 +23,6 @@ import javax.ejb.Local;
@Local
@Local
public
interface
BootstrapBeanLocal
{
public
interface
BootstrapBeanLocal
{
void
saneDefaults
();
// no empty databases
// void saneDefaults();
}
}
code/moya-beans/ejbModule/fi/codecrew/moya/beans/BootstrapBean.java
View file @
b68a5c2
...
@@ -298,16 +298,16 @@ public class BootstrapBean implements BootstrapBeanLocal {
...
@@ -298,16 +298,16 @@ public class BootstrapBean implements BootstrapBeanLocal {
dbModelFacade
.
create
(
dBm
);
dbModelFacade
.
create
(
dBm
);
}
}
}
}
// We will never run this again with empty database
public
void
saneDefaults
()
{
//
public void saneDefaults() {
User
adminUser
=
userFacade
.
findByLogin
(
"admin"
);
//
User adminUser = userFacade.findByLogin("admin");
if
(
adminUser
==
null
)
{
//
if (adminUser == null) {
adminUser
=
new
User
();
//
adminUser = new User();
adminUser
.
setLogin
(
"admin"
);
//
adminUser.setLogin("admin");
// adminUser.setSuperadmin(true);
//
// adminUser.setSuperadmin(true);
adminUser
.
resetPassword
(
"admin"
);
//
adminUser.resetPassword("admin");
userFacade
.
create
(
adminUser
);
//
userFacade.create(adminUser);
}
//
}
}
//
}
}
}
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/user/AuthView.java
View file @
b68a5c2
...
@@ -131,7 +131,7 @@ public class AuthView extends GenericCDIView {
...
@@ -131,7 +131,7 @@ public class AuthView extends GenericCDIView {
private
void
doLogin
(
String
onError
)
{
private
void
doLogin
(
String
onError
)
{
bootStrapBean
.
saneDefaults
();
//
bootStrapBean.saneDefaults();
if
(
login
==
null
||
password
==
null
||
login
.
isEmpty
()
||
password
.
isEmpty
())
{
if
(
login
==
null
||
password
==
null
||
login
.
isEmpty
()
||
password
.
isEmpty
())
{
return
;
return
;
...
@@ -163,7 +163,9 @@ public class AuthView extends GenericCDIView {
...
@@ -163,7 +163,9 @@ public class AuthView extends GenericCDIView {
}
else
{
}
else
{
navihandler
.
forward
(
onError
);
navihandler
.
forward
(
onError
);
try
{
try
{
request
.
login
(
User
.
ANONYMOUS_LOGINNAME
,
null
);
request
.
logout
();
request
.
getSession
().
invalidate
();
navihandler
.
forward
(
"/frontpage?faces-redirect=true"
);
}
catch
(
ServletException
e
)
{
}
catch
(
ServletException
e
)
{
logger
.
warn
(
"Error while trying to relogin as anonymous"
,
e
);
logger
.
warn
(
"Error while trying to relogin as anonymous"
,
e
);
}
}
...
...
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