Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SkuciSe
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tim 2 - 2022
SkuciSe
Commits
d55e96eb
Commit
d55e96eb
authored
Aug 31, 2022
by
Milovan Samardzic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ProfilFront
parent
49bac211
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
315 additions
and
28 deletions
+315
-28
SkuciSe/src/main/java/com/example/SkuciSe/configuration/WebSecurityConfig.java
+4
-4
SkuciSe/src/main/java/com/example/SkuciSe/controller/AppController.java
+8
-1
SkuciSe/src/main/java/com/example/SkuciSe/controller/AppRestController.java
+8
-8
SkuciSe/src/main/java/com/example/SkuciSe/repository/KorisnikRepository.java
+15
-0
SkuciSe/src/main/resources/static/css/style.css
+181
-0
SkuciSe/src/main/resources/templates/index.html
+26
-14
SkuciSe/src/main/resources/templates/login.html
+1
-1
SkuciSe/src/main/resources/templates/profile.html
+72
-0
No files found.
SkuciSe/src/main/java/com/example/SkuciSe/configuration/WebSecurityConfig.java
View file @
d55e96eb
...
...
@@ -43,10 +43,10 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter
http
.
authorizeRequests
()
.
antMatchers
(
"/proba"
).
authenticated
()
.
anyRequest
().
permitAll
()
.
and
().
formLogin
()
.
usernameParameter
(
"email"
)
.
defaultSuccessUrl
(
"/proba
"
)
.
permitAll
()
.
and
().
formLogin
()
.
loginPage
(
"/login"
).
permitAll
()
.
usernameParameter
(
"email"
)
.
defaultSuccessUrl
(
"/index
"
)
.
permitAll
()
.
and
().
logout
().
logoutSuccessUrl
(
"/index"
).
permitAll
();
}
}
SkuciSe/src/main/java/com/example/SkuciSe/controller/AppController.java
View file @
d55e96eb
...
...
@@ -9,6 +9,7 @@ import org.springframework.stereotype.Controller;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
@Controller
...
...
@@ -44,5 +45,11 @@ public class AppController
kRepo
.
insert
(
korisnik
);
return
(
"redirect:/login"
);
}
@GetMapping
(
"/profile/{korisnikid}"
)
public
String
getProfile
(
@PathVariable
(
"korisnikid"
)
int
korisnikid
,
Model
model
,
@AuthenticationPrincipal
KorisnikDetails
korisnik
)
{
model
.
addAttribute
(
"korisnik"
,
kRepo
.
findById
(
korisnikid
));
model
.
addAttribute
(
"loggedUser"
,
korisnik
);
return
(
"profile"
);
}
}
SkuciSe/src/main/java/com/example/SkuciSe/controller/AppRestController.java
View file @
d55e96eb
package
com
.
example
.
SkuciSe
.
controller
;
import
com.example.SkuciSe.model.korisnik.Korisnik
;
import
com.example.SkuciSe.model.korisnik.KorisnikDetails
;
import
lombok.Getter
;
import
com.example.SkuciSe.repository.KorisnikRepository
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.core.annotation.AuthenticationPrincipal
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
public
class
AppRestController
{
@GetMapping
(
"/proba"
)
public
String
proba
(
@AuthenticationPrincipal
KorisnikDetails
korisnik
)
{
return
(
"<h1>Dobrodosao, "
+
korisnik
.
getKorisnik
().
getIme
()+
"/h1>"
);
}
}
}
\ No newline at end of file
SkuciSe/src/main/java/com/example/SkuciSe/repository/KorisnikRepository.java
View file @
d55e96eb
...
...
@@ -6,6 +6,7 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import
org.springframework.stereotype.Component
;
import
java.sql.*
;
import
java.util.Optional
;
@Component
public
class
KorisnikRepository
...
...
@@ -47,4 +48,18 @@ public class KorisnikRepository
}
return
(
null
);
}
public
Korisnik
findById
(
Integer
id
){
String
sql
=
"select * from korisnik where KorisnikId = "
+
id
;
ResultSet
rs
=
null
;
try
{
rs
=
statement
.
executeQuery
(
sql
);
while
(
rs
.
next
())
{
return
(
new
Korisnik
(
rs
.
getInt
(
"korisnikId"
),
rs
.
getString
(
"ime"
),
rs
.
getString
(
"prezime"
),
rs
.
getString
(
"email"
),
rs
.
getString
(
"sifra"
),
rs
.
getString
(
"telefon"
),
rs
.
getInt
(
"tipid"
)));
}
}
catch
(
SQLException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
(
null
);
}
}
SkuciSe/src/main/resources/static/css/style.css
View file @
d55e96eb
...
...
@@ -260,4 +260,184 @@ h3{
.valid-feedback
{
color
:
#2acc80
;
}
.card.user-card
{
border-top
:
none
;
-webkit-box-shadow
:
0
0
1px
2px
rgba
(
0
,
0
,
0
,
0.05
),
0
-2px
1px
-2px
rgba
(
0
,
0
,
0
,
0.04
),
0
0
0
-1px
rgba
(
0
,
0
,
0
,
0.05
);
box-shadow
:
0
0
1px
2px
rgba
(
0
,
0
,
0
,
0.05
),
0
-2px
1px
-2px
rgba
(
0
,
0
,
0
,
0.04
),
0
0
0
-1px
rgba
(
0
,
0
,
0
,
0.05
);
-webkit-transition
:
all
150ms
linear
;
transition
:
all
150ms
linear
;
}
.card
{
border-radius
:
5px
;
-webkit-box-shadow
:
0
1px
2.94px
0.06px
rgba
(
4
,
26
,
55
,
0.16
);
box-shadow
:
0
1px
2.94px
0.06px
rgba
(
4
,
26
,
55
,
0.16
);
border
:
none
;
margin-bottom
:
30px
;
-webkit-transition
:
all
0.3s
ease-in-out
;
transition
:
all
0.3s
ease-in-out
;
}
.card
.card-header
{
background-color
:
transparent
;
border-bottom
:
none
;
padding
:
25px
;
}
.card
.card-header
h5
{
margin-bottom
:
0
;
color
:
#222
;
font-size
:
14px
;
font-weight
:
600
;
display
:
inline-block
;
margin-right
:
10px
;
line-height
:
1.4
;
}
.card
.card-header
+
.card-block
,
.card
.card-header
+
.card-block-big
{
padding-top
:
0
;
}
.user-card
.card-block
{
text-align
:
center
;
}
.card
.card-block
{
padding
:
25px
;
}
.user-card
.card-block
.user-image
{
position
:
relative
;
margin
:
0
auto
;
display
:
inline-block
;
padding
:
5px
;
width
:
110px
;
height
:
110px
;
}
.user-card
.card-block
.user-image
img
{
z-index
:
20
;
position
:
absolute
;
top
:
5px
;
left
:
5px
;
width
:
100px
;
height
:
100px
;
}
.img-radius
{
border-radius
:
50%
;
}
.f-w-600
{
font-weight
:
600
;
}
.m-b-10
{
margin-bottom
:
10px
;
}
.m-t-25
{
margin-top
:
25px
;
}
.m-t-15
{
margin-top
:
15px
;
}
.card
.card-block
p
{
line-height
:
1.4
;
}
.text-muted
{
color
:
#919aa3
!important
;
}
.user-card
.card-block
.activity-leval
li
.active
{
background-color
:
#2ed8b6
;
}
.user-card
.card-block
.activity-leval
li
{
display
:
inline-block
;
width
:
15%
;
height
:
4px
;
margin
:
0
3px
;
background-color
:
#ccc
;
}
.user-card
.card-block
.counter-block
{
color
:
#fff
;
}
.bg-c-blue
{
background
:
linear-gradient
(
45deg
,
#4099ff
,
#73b4ff
);
}
.bg-c-green
{
background
:
linear-gradient
(
45deg
,
#2ed8b6
,
#59e0c5
);
}
.bg-c-yellow
{
background
:
linear-gradient
(
45deg
,
#FFB64D
,
#ffcb80
);
}
.bg-c-pink
{
background
:
linear-gradient
(
45deg
,
#FF5370
,
#ff869a
);
}
.m-t-10
{
margin-top
:
10px
;
}
.p-20
{
padding
:
20px
;
}
.user-card
.card-block
.user-social-link
i
{
font-size
:
30px
;
}
.text-facebook
{
color
:
#3B5997
;
}
.text-twitter
{
color
:
#42C0FB
;
}
.text-dribbble
{
color
:
#EC4A89
;
}
.user-card
.card-block
.user-image
:before
{
bottom
:
0
;
border-bottom-left-radius
:
50px
;
border-bottom-right-radius
:
50px
;
}
.user-card
.card-block
.user-image
:after
,
.user-card
.card-block
.user-image
:before
{
content
:
""
;
width
:
100%
;
height
:
48%
;
border
:
2px
solid
#4099ff
;
position
:
absolute
;
left
:
0
;
z-index
:
10
;
}
.user-card
.card-block
.user-image
:after
{
top
:
0
;
border-top-left-radius
:
50px
;
border-top-right-radius
:
50px
;
}
.user-card
.card-block
.user-image
:after
,
.user-card
.card-block
.user-image
:before
{
content
:
""
;
width
:
100%
;
height
:
48%
;
border
:
2px
solid
#4099ff
;
position
:
absolute
;
left
:
0
;
z-index
:
10
;
}
\ No newline at end of file
SkuciSe/src/main/resources/templates/index.html
View file @
d55e96eb
...
...
@@ -31,27 +31,39 @@
<!--<img src="../static/images/logo.png" alt="Logo">-->
<div
id=
"navbar-login"
>
<ul>
<li><a
th:href=
"@{/login}"
><i
class=
"fas fa-sign-in-alt"
></i><span
style=
"padding:5px;"
>
Uloguj se
</span></a></li>
<li><a
th:href=
"@{/register}"
><i
class=
"fa-solid fa-circle-user"
></i><span
style=
"padding:5px;"
>
Registruj se
</span></a></li>
<li
th:if=
"${loggedUser == null}"
><a
th:href=
"@{/login}"
><i
class=
"fas fa-sign-in-alt"
></i><span
style=
"padding:5px;"
>
Prijavi se
</span></a></li>
<li
th:if=
"${loggedUser != null}"
>
<form
th:action=
"@{/logout}"
method=
"post"
id=
"my_form"
>
<a
href=
"#"
onclick=
"document.getElementById('my_form').submit(); return false;"
><i
class=
"fas fa-sign-in-alt"
></i><span
style=
"padding:5px;"
>
Odjavi se
</span></a>
</form>
</li>
<li
th:if=
"${loggedUser == null}"
><a
th:href=
"@{/register}"
><i
class=
"fa-solid fa-circle-user"
></i><span
style=
"padding:5px;"
>
Registruj se
</span></a></li>
<li
th:if=
"${loggedUser != null}"
><a
th:href=
"@{/profile/{korisnikid}(korisnikid=${loggedUser.getKorisnik().getKorisnikId()})}"
><i
class=
"fa-solid fa-circle-user"
></i><span
style=
"padding:5px;"
th:text=
"${loggedUser.getKorisnik().getIme()}"
></span></a></li>
<li><button
type=
"button"
class=
"btn btn-primary btn-md"
><i
class=
"fa-regular fa-message"
></i>
Postavite novi oglas
</button></li>
</ul>
</div>
</header>
<div
id=
"pozadina"
>
<h1>
<span
th:if=
"${loggedUser == null}"
>
Uloguj se
</span>
<span
th:if=
"${loggedUser != null}"
th:text=
"${loggedUser.getKorisnik().getIme()}"
></span>
</h1>
</div>
<footer
class=
"text-center text-white fixed-bottom"
style=
"background-color: #21081a;"
>
<!-- Copyright -->
<div
class=
"text-center p-3"
style=
"background-color: #d8dde0;"
>
© 2020 Copyright:
<a
class=
"text-white"
href=
"https://mdbootstrap.com/"
>
PMFKG
</a>
</div>
</footer>
<div
class=
"container-fluid pb-0 mb-0 justify-content-center text-light "
>
<footer>
<div
class=
"row my-5 justify-content-center py-5"
>
<div
class=
"col-11"
>
<div
class=
"row "
>
<div
class=
"col-xl-8 col-md-4 col-sm-4 col-12 my-auto mx-auto a"
><h3
class=
"text-muted mb-md-0 mb-5 bold-text"
>
SkuciSe
</h3></div>
<div
class=
"col-xl-2 col-md-4 col-sm-4 col-12"
><h6
class=
"mb-3 mb-lg-4 bold-text "
><b>
MENI
</b></h6><ul
class=
"list-unstyled"
><li>
Pocetna
</li><li>
O nama
</li><li>
Blog
</li><li>
Portfolio
</li></ul></div>
<div
class=
"col-xl-2 col-md-4 col-sm-4 col-12"
><h6
class=
"mb-3 mb-lg-4 text-muted bold-text mt-sm-0 mt-5"
><b>
ADRESA
</b></h6><p
class=
"mb-1"
>
Radoja Domanovića 12
</p><p>
Kragujevac 34000
</p>
</div>
</div>
<div
class=
"row "
>
<div
class=
"col-xl-8 col-md-4 col-sm-4 col-auto my-md-0 mt-5 order-sm-1 order-3 align-self-end"
><p
class=
"social text-muted mb-0 pb-0 bold-text"
>
<span
class=
"mx-2"
><i
class=
"fa fa-facebook"
aria-hidden=
"true"
></i></span>
<span
class=
"mx-2"
><i
class=
"fa fa-linkedin-square"
aria-hidden=
"true"
></i></span>
<span
class=
"mx-2"
><i
class=
"fa fa-twitter"
aria-hidden=
"true"
></i></span>
<span
class=
"mx-2"
><i
class=
"fa fa-instagram"
aria-hidden=
"true"
></i></span>
</p><small
class=
"rights"
><span>
®
</span>
SkuciSe All Rights Reserved.
</small></div>
<div
class=
"col-xl-2 col-md-4 col-sm-4 col-auto order-1 align-self-end "
><h6
class=
"mt-55 mt-2 text-muted bold-text"
><b>
PERA PERIC
</b></h6><small>
<span><i
class=
"fa fa-envelope"
aria-hidden=
"true"
></i></span>
pera@gmail.com
</small></div>
<div
class=
"col-xl-2 col-md-4 col-sm-4 col-auto order-2 align-self-end mt-3 "
><h6
class=
"text-muted bold-text"
><b>
ACA ACIC
</b></h6><small><span><i
class=
"fa fa-envelope"
aria-hidden=
"true"
></i></span>
aca@gmail.com
</small></div>
</div>
</div>
</div>
</footer>
</div>
<script
src=
"https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
></script>
<script
src=
"https://kit.fontawesome.com/51d1fadef3.js"
crossorigin=
"anonymous"
></script>
<script
src=
"/js/main.js"
></script>
...
...
SkuciSe/src/main/resources/templates/login.html
View file @
d55e96eb
...
...
@@ -52,7 +52,7 @@
</div>
<div
class=
"col-md-12"
>
<input
class=
"form-control"
type=
"
text
"
name=
"password"
placeholder=
"Sifra"
required
>
<input
class=
"form-control"
type=
"
password
"
name=
"password"
placeholder=
"Sifra"
required
>
<div
class=
"invalid-feedback"
>
Sifra ne sme biti prazna!
</div>
</div>
...
...
SkuciSe/src/main/resources/templates/profile.html
0 → 100644
View file @
d55e96eb
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"utf-8"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta
name=
"description"
content=
""
/>
<meta
name=
"author"
content=
""
/>
<title>
Small Business - Start Bootstrap Template
</title>
<link
href=
'https://fonts.googleapis.com/css?family=Jost'
rel=
'stylesheet'
>
<!-- Favicon-->
<link
rel=
"icon"
type=
"image/x-icon"
href=
"assets/favicon.ico"
/>
<!-- CSS only -->
<link
href=
"https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css"
rel=
"stylesheet"
integrity=
"sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx"
crossorigin=
"anonymous"
>
<!-- Core theme CSS (includes Bootstrap)-->
<link
href=
"/css/style.css"
rel=
"stylesheet"
/>
</head>
<body
th:object=
"${loggedUser}"
>
<header>
<nav>
<ul>
<li><a
th:href=
"@{/index}"
>
Pocetna
</a></li>
<li><a
href=
"#"
>
Kategorije
</a></li>
<li><a
href=
"#"
>
O nama
</a></li>
</ul>
</nav>
<!--<img src="../static/images/logo.png" alt="Logo">-->
<div
id=
"navbar-login"
>
<ul>
<li
th:if=
"${loggedUser == null}"
><a
th:href=
"@{/login}"
><i
class=
"fas fa-sign-in-alt"
></i><span
style=
"padding:5px;"
>
Prijavi se
</span></a></li>
<li
th:if=
"${loggedUser != null}"
>
<form
th:action=
"@{/logout}"
method=
"post"
id=
"my_form"
>
<a
href=
"#"
onclick=
"document.getElementById('my_form').submit(); return false;"
><i
class=
"fas fa-sign-in-alt"
></i><span
style=
"padding:5px;"
>
Odjavi se
</span></a>
</form>
</li>
<li
th:if=
"${loggedUser == null}"
><a
th:href=
"@{/register}"
><i
class=
"fa-solid fa-circle-user"
></i><span
style=
"padding:5px;"
>
Registruj se
</span></a></li>
<li
th:if=
"${loggedUser != null}"
><a
th:href=
"@{/profile/{korisnikid}(korisnikid=${loggedUser.getKorisnik().getKorisnikId()})}"
><i
class=
"fa-solid fa-circle-user"
></i><span
style=
"padding:5px;"
th:text=
"${loggedUser.getKorisnik().getIme()}"
></span></a></li>
<li><button
type=
"button"
class=
"btn btn-primary btn-md"
><i
class=
"fa-regular fa-message"
></i>
Postavite novi oglas
</button></li>
</ul>
</div>
</header>
<div
class=
"container-fluid pb-0 mb-0 justify-content-center text-light "
>
<footer>
<div
class=
"row my-5 justify-content-center py-5"
>
<div
class=
"col-11"
>
<div
class=
"row "
>
<div
class=
"col-xl-8 col-md-4 col-sm-4 col-12 my-auto mx-auto a"
><h3
class=
"text-muted mb-md-0 mb-5 bold-text"
>
Pepper.
</h3></div>
<div
class=
"col-xl-2 col-md-4 col-sm-4 col-12"
><h6
class=
"mb-3 mb-lg-4 bold-text "
><b>
MENU
</b></h6><ul
class=
"list-unstyled"
><li>
Home
</li><li>
About
</li><li>
Blog
</li><li>
Portfolio
</li></ul></div>
<div
class=
"col-xl-2 col-md-4 col-sm-4 col-12"
><h6
class=
"mb-3 mb-lg-4 text-muted bold-text mt-sm-0 mt-5"
><b>
ADDRESS
</b></h6><p
class=
"mb-1"
>
605, RATAN ICON BUILDING
</p><p>
SEAWOODS SECTOR
</p>
</div>
</div>
<div
class=
"row "
>
<div
class=
"col-xl-8 col-md-4 col-sm-4 col-auto my-md-0 mt-5 order-sm-1 order-3 align-self-end"
><p
class=
"social text-muted mb-0 pb-0 bold-text"
>
<span
class=
"mx-2"
><i
class=
"fa fa-facebook"
aria-hidden=
"true"
></i></span>
<span
class=
"mx-2"
><i
class=
"fa fa-linkedin-square"
aria-hidden=
"true"
></i></span>
<span
class=
"mx-2"
><i
class=
"fa fa-twitter"
aria-hidden=
"true"
></i></span>
<span
class=
"mx-2"
><i
class=
"fa fa-instagram"
aria-hidden=
"true"
></i></span>
</p><small
class=
"rights"
><span>
®
</span>
PMFKG All Rights Reserved.
</small></div>
<div
class=
"col-xl-2 col-md-4 col-sm-4 col-auto order-1 align-self-end "
><h6
class=
"mt-55 mt-2 text-muted bold-text"
><b>
ANIRUDH SINGLA
</b></h6><small>
<span><i
class=
"fa fa-envelope"
aria-hidden=
"true"
></i></span>
anirudh@gmail.com
</small></div>
<div
class=
"col-xl-2 col-md-4 col-sm-4 col-auto order-2 align-self-end mt-3 "
><h6
class=
"text-muted bold-text"
><b>
RISHABH SHEKHAR
</b></h6><small><span><i
class=
"fa fa-envelope"
aria-hidden=
"true"
></i></span>
rishab@gmail.com
</small></div>
</div>
</div>
</div>
</footer>
</div>
<script
src=
"https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
></script>
<script
src=
"https://kit.fontawesome.com/51d1fadef3.js"
crossorigin=
"anonymous"
></script>
<script
src=
"/js/main.js"
></script>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment