Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
componente central
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
TSE2019-G1
componente central
Commits
4e85288e
Commit
4e85288e
authored
5 years ago
by
Falucho
Browse files
Options
Downloads
Patches
Plain Diff
Se comienza a trabajar con JWT
parent
30008c10
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
backoffice/src/main/java/uy/edu/fing/tse/jsf/UserLoginBean.java
+26
-3
26 additions, 3 deletions
...fice/src/main/java/uy/edu/fing/tse/jsf/UserLoginBean.java
backoffice/src/main/webapp/jsf/login.xhtml
+5
-3
5 additions, 3 deletions
backoffice/src/main/webapp/jsf/login.xhtml
with
31 additions
and
6 deletions
backoffice/src/main/java/uy/edu/fing/tse/jsf/UserLoginBean.java
+
26
−
3
View file @
4e85288e
...
...
@@ -40,6 +40,8 @@ public class UserLoginBean implements Serializable {
private
String
repassword
;
private
String
token
;
public
List
<
Role
>
getRoles
()
{
return
roles
;
}
...
...
@@ -60,12 +62,33 @@ public class UserLoginBean implements Serializable {
this
.
repassword
=
repassword
;
}
public
void
login
()
{
public
String
getToken
()
{
return
token
;
}
final
var
s
=
securityLocal
.
login
(
user
);
LOG
.
info
(
s
)
;
public
void
setToken
(
String
token
)
{
this
.
token
=
token
;
}
public
String
login
()
{
token
=
securityLocal
.
login
(
user
);
if
(
token
!=
null
)
{
try
{
//TODO sacar
Thread
.
sleep
(
2000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
return
"gestionhechos"
;
}
else
{
FacesContext
.
getCurrentInstance
().
addMessage
(
null
,
new
FacesMessage
(
FacesMessage
.
SEVERITY_WARN
,
"Ingreso incorrecto"
,
"Por favor verificar los datos ingresados"
));
return
""
;
}
}
public
String
register
()
{
boolean
valid
=
true
;
...
...
This diff is collapsed.
Click to expand it.
backoffice/src/main/webapp/jsf/login.xhtml
+
5
−
3
View file @
4e85288e
...
...
@@ -14,17 +14,19 @@
<h:panelGrid
columns=
"3"
cellpadding=
"5"
id=
"form"
>
<h:outputLabel
for=
"username"
value=
"Username:"
/>
<p:inputText
id=
"username"
value=
"#{userLoginView.user.mail}"
required=
"true"
requiredMessage=
"Ingrese su e-mail"
label=
"username"
/>
<p:inputText
id=
"username"
value=
"#{userLoginView.user.mail}"
required=
"true"
requiredMessage=
"Ingrese su e-mail"
label=
"username"
/>
<p:message
id=
"msgName"
for=
"username"
/>
<h:outputLabel
for=
"password"
value=
"Password:"
/>
<p:password
id=
"password"
value=
"#{userLoginView.user.password}"
required=
"true"
requiredMessage=
"Ingrese: su password"
label=
"password"
/>
<p:password
id=
"password"
value=
"#{userLoginView.user.password}"
required=
"true"
requiredMessage=
"Ingrese: su password"
label=
"password"
/>
<p:message
id=
"msgPassword"
for=
"password"
/>
<f:facet
name=
"footer"
>
<p:commandButton
value=
"Register"
action=
"register.xhmtl?faces-redirect=true"
update=
"form"
async=
"true"
process=
"@this"
/>
<p:commandButton
value=
"Login"
action=
"#{userLoginView.login()}"
update=
"form"
/>
</f:facet>
<h:outputLabel
value=
"#{userLoginView.token}"
/>
</h:panelGrid>
</h:form>
</ui:define>
...
...
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