Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Codecrew
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
30
Merge Requests
2
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d1b42669
authored
Feb 20, 2016
by
Antti Vesanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#90
: Näytä virheilmoitus kirjautumisen epäonnistuessa
1 parent
42255cc4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
code/moya-web/WebContent/resources/templates/primelayout/template.xhtml
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/user/AuthView.java
code/moya-web/WebContent/resources/templates/primelayout/template.xhtml
View file @
d1b4266
...
...
@@ -153,6 +153,7 @@
<p:fieldset
id=
"leftuserinfo"
rendered=
"#{!sessionHandler.loggedIn}"
>
<div
style=
"text-align: left; padding: 0.7em;"
>
<h:form>
<h:outputText
rendered=
"#{authView.loginError}"
styleClass=
"error"
value=
"#{i18n['loginerror.message']}"
/><br
/>
<p:inputText
styleClass=
"form"
id=
"linelogin"
value=
"#{authView.login}"
/>
<p:watermark
for=
"linelogin"
value=
"#{i18n['login.username']}"
/>
<br
/>
...
...
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/user/AuthView.java
View file @
d1b4266
...
...
@@ -129,11 +129,17 @@ public class AuthView extends GenericCDIView {
doLogin
(
onError
);
}
private
boolean
loginError
=
false
;
public
boolean
isLoginError
()
{
return
loginError
;
}
private
void
doLogin
(
String
onError
)
{
// bootStrapBean.saneDefaults();
if
(
login
==
null
||
password
==
null
||
login
.
isEmpty
()
||
password
.
isEmpty
())
{
logger
.
info
(
"Username or password was empty"
);
this
.
loginError
=
true
;
return
;
}
...
...
@@ -157,6 +163,7 @@ public class AuthView extends GenericCDIView {
try
{
request
.
login
(
login
.
trim
().
toLowerCase
(),
password
);
}
catch
(
Exception
e
)
{
this
.
loginError
=
true
;
logger
.
info
(
"Error while trying to login {}"
,
e
.
getMessage
());
}
finally
{
...
...
@@ -168,11 +175,11 @@ public class AuthView extends GenericCDIView {
navihandler
.
redirectToSaved
();
}
else
{
navihandler
.
forward
(
onError
);
//
navihandler.forward(onError);
try
{
request
.
logout
();
request
.
getSession
().
invalidate
();
navihandler
.
forward
(
"/frontpage?faces-redirect=true"
);
//
navihandler.forward("/frontpage?faces-redirect=true");
}
catch
(
ServletException
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