Move login, logout and register to /api/v1/user
This commit is contained in:
parent
2619566a62
commit
a504e4d382
15
http/http.go
15
http/http.go
@ -34,10 +34,17 @@ func (h *Handler) Serve() {
|
|||||||
router.GET("/dashboard", h.dashboard)
|
router.GET("/dashboard", h.dashboard)
|
||||||
api := router.Group("/api/v1")
|
api := router.Group("/api/v1")
|
||||||
{
|
{
|
||||||
api.GET("/logout", logout)
|
user := api.Group("/user")
|
||||||
api.GET("/login", func(c *gin.Context) { c.Redirect(http.StatusPermanentRedirect, "/login") })
|
{
|
||||||
api.POST("/login", h.loginPost)
|
user.GET("/logout", logout)
|
||||||
api.POST("/register", h.registerPost)
|
user.GET("/login", func(c *gin.Context) { c.Redirect(http.StatusPermanentRedirect, "/login") })
|
||||||
|
user.POST("/login", h.loginPost)
|
||||||
|
user.POST("/register", h.registerPost)
|
||||||
|
}
|
||||||
|
budget := api.Group("budget")
|
||||||
|
{
|
||||||
|
budget.POST("")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
router.Run(":1323")
|
router.Run(":1323")
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
$('#invalidCredentials').hide();
|
$('#invalidCredentials').hide();
|
||||||
$('#loginForm').ajaxForm({
|
$('#loginForm').ajaxForm({
|
||||||
success: function() {
|
success: function() {
|
||||||
window.location.href = "/api/v1/restricted";
|
window.location.href = "/dashboard";
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
$('#invalidCredentials').show();
|
$('#invalidCredentials').show();
|
||||||
@ -25,7 +25,7 @@
|
|||||||
Budgeteer
|
Budgeteer
|
||||||
</div>
|
</div>
|
||||||
<div class="container col-lg-12" id="content">
|
<div class="container col-lg-12" id="content">
|
||||||
<form id="loginForm" action="/api/v1/login" method="POST" class="center-block">
|
<form id="loginForm" action="/api/v1/user/login" method="POST" class="center-block">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="username">User</label>
|
<label for="username">User</label>
|
||||||
<input type="text" name="username" class="form-control" placeholder="User" />
|
<input type="text" name="username" class="form-control" placeholder="User" />
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
return match;
|
return match;
|
||||||
},
|
},
|
||||||
success: function() {
|
success: function() {
|
||||||
window.location.href = "/api/v1/restricted";
|
window.location.href = "/dashboard";
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
$('#invalidCredentials').show();
|
$('#invalidCredentials').show();
|
||||||
@ -47,7 +47,7 @@
|
|||||||
Budgeteer
|
Budgeteer
|
||||||
</div>
|
</div>
|
||||||
<div class="container col-lg-12" id="content">
|
<div class="container col-lg-12" id="content">
|
||||||
<form id="loginForm" action="/api/v1/register" method="POST" class="center-block">
|
<form id="loginForm" action="/api/v1/user/register" method="POST" class="center-block">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="email">E-Mail</label>
|
<label for="email">E-Mail</label>
|
||||||
<input type="text" name="email" class="form-control" placeholder="E-Mail" />
|
<input type="text" name="email" class="form-control" placeholder="E-Mail" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user