fix change password and support 3 decimal places

This commit is contained in:
Akhil Gupta
2021-06-01 21:43:41 +05:30
parent d41a41e25a
commit 1ca98cec24
7 changed files with 14 additions and 10 deletions

View File

@@ -8,7 +8,7 @@
</a> --> </a> -->
<h1 align="center" style="margin-bottom:0">Hammond</h1> <h1 align="center" style="margin-bottom:0">Hammond</h1>
<p align="center">Current Version - 2021.05.29</p> <p align="center">Current Version - 2021.06.01</p>
<p align="center"> <p align="center">
A self-hosted vehicle expense tracking system with support for multiple users. A self-hosted vehicle expense tracking system with support for multiple users.
@@ -55,7 +55,7 @@ The current version of Hammond is written using GO for backend and Vuejs for the
Also I had initially thought of a 2 container approach (1 for backend and 1 for the frontend) so that they can be independently maintained and updated. I eventually decided against this idea for the sake of simplicity. Although it is safe to assume that most self-hosters are fairly tech capable it still is much better to have a single container that you can fire and forget. Also I had initially thought of a 2 container approach (1 for backend and 1 for the frontend) so that they can be independently maintained and updated. I eventually decided against this idea for the sake of simplicity. Although it is safe to assume that most self-hosters are fairly tech capable it still is much better to have a single container that you can fire and forget.
![Product Name Screen Shot][product-screenshot] [More Screenshots](Shreenshots.md) ![Product Name Screen Shot][product-screenshot] [More Screenshots](Screenshots.md)
### Built With ### Built With

View File

@@ -169,7 +169,7 @@ func changePassword(c *gin.Context) {
} }
if user.CheckPassword(request.OldPassword) != nil { if user.CheckPassword(request.OldPassword) != nil {
c.JSON(http.StatusForbidden, common.NewError("changePassword", errors.New("Not Registered email or invalid password"))) c.JSON(http.StatusForbidden, common.NewError("changePassword", errors.New("Incorrect old password")))
return return
} }

View File

@@ -25,6 +25,6 @@ type RegisterRequest struct {
} }
type ChangePasswordRequest struct { type ChangePasswordRequest struct {
OldPassword string `form:"oldPassword" json:"oldPassword" binding:"required,min=8,max=255"` OldPassword string `form:"oldPassword" json:"oldPassword" binding:"required,max=255"`
NewPassword string `form:"newPassword" json:"newPassword" binding:"required,min=8,max=255"` NewPassword string `form:"newPassword" json:"newPassword" binding:"required,min=8,max=255"`
} }

View File

@@ -195,7 +195,7 @@ export default {
type="number" type="number"
min="0" min="0"
expanded expanded
step=".01" step=".001"
required required
></b-input> ></b-input>
</b-field> </b-field>

View File

@@ -206,7 +206,7 @@ export default {
<b-input <b-input
v-model.number="fillupModel.fuelQuantity" v-model.number="fillupModel.fuelQuantity"
type="number" type="number"
step=".01" step=".001"
min="0" min="0"
expanded expanded
required required
@@ -225,7 +225,7 @@ export default {
v-model.number="fillupModel.perUnitPrice" v-model.number="fillupModel.perUnitPrice"
type="number" type="number"
min="0" min="0"
step=".01" step=".001"
expanded expanded
required required
></b-input> ></b-input>
@@ -238,7 +238,7 @@ export default {
v-model.number="fillupModel.totalAmount" v-model.number="fillupModel.totalAmount"
type="number" type="number"
min="0" min="0"
step=".01" step=".001"
expanded expanded
required required
></b-input> ></b-input>

View File

@@ -69,9 +69,13 @@ export default {
.catch((err) => console.log('error:', err)) .catch((err) => console.log('error:', err))
}) })
.catch((ex) => { .catch((ex) => {
let errorMessage= ex.message;
if(ex.response && ex.response.data?.errors?.changePassword){
errorMessage=ex.response.data?.errors?.changePassword
}
this.$buefy.toast.open({ this.$buefy.toast.open({
duration: 5000, duration: 5000,
message: ex.message, message: errorMessage,
position: 'is-bottom', position: 'is-bottom',
type: 'is-danger', type: 'is-danger',
}) })
@@ -168,7 +172,7 @@ export default {
<table class="table is-hoverable"> <table class="table is-hoverable">
<tr> <tr>
<td>Current Version</td> <td>Current Version</td>
<td>2021.05.29</td> <td>2021.06.01</td>
</tr> </tr>
<tr> <tr>
<td>Website</td> <td>Website</td>