Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
LaMartin-Webomagic
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Deep Dey
LaMartin-Webomagic
Commits
b121299f
Commit
b121299f
authored
Nov 16, 2025
by
Deep Dey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add user login api
parent
696f5a43
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
128 additions
and
4 deletions
+128
-4
lamartinBackend/src/main/java/com/example/LaMartin/config/Settings.java
...d/src/main/java/com/example/LaMartin/config/Settings.java
+6
-0
lamartinBackend/src/main/java/com/example/LaMartin/user/controller/UserController.java
.../com/example/LaMartin/user/controller/UserController.java
+68
-0
lamartinBackend/src/main/java/com/example/LaMartin/user/pojo/LoginPayload.java
...ain/java/com/example/LaMartin/user/pojo/LoginPayload.java
+15
-0
lamartinBackend/src/main/java/com/example/LaMartin/user/utills/GenerateKey.java
...in/java/com/example/LaMartin/user/utills/GenerateKey.java
+15
-0
lamartinBackend/src/main/resources/application-dev.properties
...rtinBackend/src/main/resources/application-dev.properties
+3
-1
lamartinBackend/src/main/resources/application-hostinger.properties
...ckend/src/main/resources/application-hostinger.properties
+18
-0
lamartinBackend/src/main/resources/application-prod.properties
...tinBackend/src/main/resources/application-prod.properties
+2
-2
lamartinBackend/src/main/resources/application.properties
lamartinBackend/src/main/resources/application.properties
+1
-1
No files found.
lamartinBackend/src/main/java/com/example/LaMartin/config/Settings.java
View file @
b121299f
...
...
@@ -14,6 +14,12 @@ public class Settings {
@Value
(
"${lamartin.static.server.path}"
)
private
String
staticServerPath
;
@Value
(
"${lamartin.username}"
)
private
String
username
;
@Value
(
"${lamartin.password}"
)
private
String
password
;
public
String
getImageStoragePath
()
{
return
staticResourcesRootPath
+
"/images/"
;
}
...
...
lamartinBackend/src/main/java/com/example/LaMartin/user/controller/UserController.java
0 → 100644
View file @
b121299f
package
com
.
example
.
LaMartin
.
user
.
controller
;
import
com.example.LaMartin.admission.model.AdmissionFormData
;
import
com.example.LaMartin.common.model.GeneralResponse
;
import
com.example.LaMartin.config.Settings
;
import
com.example.LaMartin.constants.AppConstants
;
import
com.example.LaMartin.user.pojo.LoginPayload
;
import
com.example.LaMartin.user.utills.GenerateKey
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
lombok.AllArgsConstructor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.validation.Valid
;
import
java.util.Objects
;
@RestController
@AllArgsConstructor
(
onConstructor
=
@__
(
@Autowired
))
public
class
UserController
{
private
final
Settings
settings
;
@PostMapping
(
value
=
"/user/login"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@ApiResponses
(
value
=
{
@ApiResponse
(
code
=
200
,
message
=
"SUCCESS"
),
@ApiResponse
(
code
=
400
,
message
=
"FAILED"
),
@ApiResponse
(
code
=
500
,
message
=
"Exception Occurred"
)
})
@ApiOperation
(
value
=
""
)
public
Object
login
(
HttpServletRequest
request
,
@Valid
@RequestBody
LoginPayload
loginPayload
)
throws
Exception
{
if
(
Objects
.
equals
(
loginPayload
.
getEmail
(),
settings
.
getUsername
())
&&
Objects
.
equals
(
loginPayload
.
getPassword
(),
settings
.
getPassword
()))
{
return
new
ResponseEntity
<>(
new
GeneralResponse
(
true
,
AppConstants
.
RESPONSE_SUCCESS_STATUS_CODE
,
"Login Successfully"
,
GenerateKey
.
randomString
(
16
)
),
HttpStatus
.
OK
);
}
else
{
return
new
ResponseEntity
<>(
new
GeneralResponse
(
false
,
AppConstants
.
RESPONSE_FAILURE_STATUS_CODE
,
"Failed to Login"
,
null
),
HttpStatus
.
OK
);
}
}
}
lamartinBackend/src/main/java/com/example/LaMartin/user/pojo/LoginPayload.java
0 → 100644
View file @
b121299f
package
com
.
example
.
LaMartin
.
user
.
pojo
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
public
class
LoginPayload
{
private
String
email
;
private
String
password
;
}
lamartinBackend/src/main/java/com/example/LaMartin/user/utills/GenerateKey.java
0 → 100644
View file @
b121299f
package
com
.
example
.
LaMartin
.
user
.
utills
;
import
java.security.SecureRandom
;
public
class
GenerateKey
{
public
static
String
randomString
(
int
len
)
{
final
String
chars
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
;
SecureRandom
rnd
=
new
SecureRandom
();
StringBuilder
sb
=
new
StringBuilder
(
len
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
sb
.
append
(
chars
.
charAt
(
rnd
.
nextInt
(
chars
.
length
())));
return
sb
.
toString
();
}
}
lamartinBackend/src/main/resources/application-dev.properties
View file @
b121299f
...
...
@@ -13,4 +13,6 @@ spring.mail.port=587
spring.mail.username
=
noreply@lamartiniere.co
spring.mail.password
=
xoobqggzxputgvky
lamartin.static.resources.root.path
=
D:/WEBSOFTTECHS/webomagic/data
lamartin.static.server.path
=
http://localhost:8084/webomagic-lamartin/
\ No newline at end of file
lamartin.static.server.path
=
http://localhost:8084/webomagic-lamartin/
lamartin.username
=
admin@lamartiniere.co
lamartin.password
=
P@$$w0rdLamartin
\ No newline at end of file
lamartinBackend/src/main/resources/application-hostinger.properties
0 → 100644
View file @
b121299f
logging.level.web
=
DEBUG
logging.file.name
=
/opt/Lamartiniere/logs/spring-inside-app.log
logging.level.root
=
INFO
server.http2.enabled
=
true
spring.datasource.url
=
jdbc:postgresql://127.0.0.1:5432/webomagic_lamartin
spring.web.resources.cache.cachecontrol.s-max-age
=
3600000
spring.datasource.username
=
magicoweb_user
spring.datasource.password
=
magicoweb@websoft@2025
spring.redis.host
=
127.0.0.1
spring.redis.port
=
6379
spring.mail.host
=
smtp.gmail.com
spring.mail.port
=
587
spring.mail.username
=
noreply@lamartiniere.co
spring.mail.password
=
xoobqggzxputgvky
lamartin.static.resources.root.path
=
/opt/Lamartiniere/data
lamartin.static.server.path
=
https://adm.lamartiniere.co/webomagic-lamartin/
lamartin.username
=
admin@lamartiniere.co
lamartin.password
=
P@$$w0rdLamartin
\ No newline at end of file
lamartinBackend/src/main/resources/application-prod.properties
View file @
b121299f
...
...
@@ -17,5 +17,5 @@ spring.mail.username=noreply@lamartiniere.co
spring.mail.password
=
xoobqggzxputgvky
lamartin.static.resources.root.path
=
/home/iitkgpssh/docker/data
lamartin.static.server.path
=
https://adm.lamartiniere.co/webomagic-lamartin/
#lamartin.static.resources.root.path=/home/ubuntu/webomagic_lamartin/data
#
lamartin.static.server.path
=
http://65.0.101.174:8084/webomagic-lamartin/
\ No newline at end of file
lamartin.username
=
admin@lamartiniere.co
lamartin.password
=
P@$$w0rdLamartin
\ No newline at end of file
lamartinBackend/src/main/resources/application.properties
View file @
b121299f
...
...
@@ -11,4 +11,4 @@ server.servlet.session.timeout=30m
server.tomcat.connection-timeout
=
600000
server.tomcat.accept-count
=
100
# application.properties
spring.profiles.active
=
prod
\ No newline at end of file
spring.profiles.active
=
hostinger
\ No newline at end of file
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