-
Notifications
You must be signed in to change notification settings - Fork 674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MF-532 - Password reset #873
Conversation
ae40e53
to
b28200a
Compare
Codecov Report
@@ Coverage Diff @@
## master #873 +/- ##
==========================================
- Coverage 84.54% 83.63% -0.92%
==========================================
Files 74 75 +1
Lines 4879 5083 +204
==========================================
+ Hits 4125 4251 +126
- Misses 513 584 +71
- Partials 241 248 +7
Continue to review full report at Codecov.
|
users/api/http/endpoint.go
Outdated
@@ -27,6 +28,54 @@ func registrationEndpoint(svc users.Service) endpoint.Endpoint { | |||
} | |||
} | |||
|
|||
// Password reset endpoint serves post request with email of the user | |||
// for whom password reset flow is to be initiated. | |||
// If request is succsesfull email with reset link will be sent to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct successful
.
users/api/http/endpoint.go
Outdated
// email specified in the request. | ||
// Link contains token that has TTL that needs to be verified. | ||
// When user gets email with reset password link this endpoint can serve | ||
// that request and return response into the ui form which than can |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct then
.
users/api/http/responses.go
Outdated
|
||
type resetPassRes struct { | ||
Msg string `json:"msg"` | ||
Error string `json:"error"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if you should have an error here. @blokovi is working on the PR that should tackle error handling and HTTP error response.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure either, but something needs to be displayed in frontend. For example if token is expired. We can remove this error. Maybe that "token expired", and "non-existent" user messages can be in Msg field.
users/postgres/users.go
Outdated
} | ||
db := struct { | ||
Email string | ||
Token string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add db
tags here.
users/api/http/requests.go
Outdated
type resetTokenReq struct { | ||
Token string | ||
Email string | ||
Password string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these are json fields, please add json tags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move the token in URL and send password and re-passowrd, don't need a email.
users/api/http/requests.go
Outdated
|
||
type passwResetReq struct { | ||
Email string | ||
Host string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these are json fields, please add json tags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the host field ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Host is extracted from the referer header, it is used for construction of the reset link
users/token/token.go
Outdated
tokenLength = ttlLength + emailLength // Max token length is 4 bytes + max email length | ||
hashCost = 10 | ||
tokenDuration = 5 // Recovery token TTL in minutes, reperesents token time to live | ||
secret = "fcERNb7KpM3WyAmguJMZ" // Random string for secret key, required for signing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably move this to the env var if you haven't already. Also, I recommend that you use https://github.com/dgrijalva/jwt-go here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO JWT is too big plus Verify() must include DB query to compare stored token and token we get which also means we need to hash JWT and save it in DB.
users/api/http/endpoint_test.go
Outdated
Password string | ||
Token string | ||
}{} | ||
// this probably needs to be moved somwhere else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments start with capital letters. You can also skip a line here.
users/service.go
Outdated
ErrRetrievingRecoveryToken = errors.New("error deleting recovery token") | ||
|
||
// ErrMisingResetToken indicates malformed or missing reset token | ||
// for reseting password. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No fullstop
users/service.go
Outdated
@@ -51,6 +77,13 @@ type Service interface { | |||
|
|||
// Get authenticated user info for the given token. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No fullstop
5ebb6ef
to
526e3fc
Compare
docker/docker-compose.yml
Outdated
MF_MAIL_DRIVER: ${MF_MAIL_DRIVER} | ||
MF_MAIL_HOST: ${MF_MAIL_HOST} | ||
MF_MAIL_PORT: ${MF_MAIL_PORT} | ||
MF_MAIL_USERNAME: ${MF_MAIL_USERNAME} | ||
MF_MAIL_PASSWORD: ${MF_MAIL_PASSWORD} | ||
MF_MAIL_FROM_ADDRESS: ${MF_MAIL_FROM_ADDRESS} | ||
MF_MAIL_FROM_NAME: ${MF_MAIL_FROM_NAME} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use EMAIL
instead of MAIL
for all envars
users/README.md
Outdated
| MF_MAIL_DRIVER | Mail server driver, mail server for sending reset password token | smtp | | ||
| MF_MAIL_HOST | Mail server host | localhost | | ||
| MF_MAIL_PORT | Mail server port | 25 | | ||
| MF_MAIL_USERNAME | Mail server username | | | ||
| MF_MAIL_PASSWORD | Mail server password | | | ||
| MF_MAIL_FROM_ADDRESS | Mail "from" address | | | ||
| MF_MAIL_FROM_NAME | Mail "from" name | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
users/README.md
Outdated
MF_MAIL_DRIVER: [Mail server driver smtp] | ||
MF_MAIL_HOST: [MF_MAIL_HOST] | ||
MF_MAIL_PORT: [MF_MAIL_PORT] | ||
MF_MAIL_USERNAME: [MF_MAIL_USERNAME] | ||
MF_MAIL_PASSWORD: [MF_MAIL_PASSWORD] | ||
MF_MAIL_FROM_ADDRESS: [MF_MAIL_FROM_ADDRESS] | ||
MF_MAIL_FROM_NAME: [MF_MAIL_FROM_NAME] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
users/service.go
Outdated
} | ||
|
||
func (svc usersService) GenerateResetToken(ctx context.Context, email, host string) error { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for empty line here.
users/users.go
Outdated
@@ -44,6 +44,9 @@ type UserRepository interface { | |||
|
|||
// RetrieveByID retrieves user by its unique identifier (i.e. email). | |||
RetrieveByID(context.Context, string) (User, error) | |||
|
|||
// UpdatePassword( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please correct this comment
users/token/token.go
Outdated
@@ -0,0 +1,155 @@ | |||
//Package token provides password recovery token generation with TTL | |||
//Token is sent by email to user as part of recovery URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put a space behind //
1136b0e
to
dff2e73
Compare
users/mail/mail.go
Outdated
envMailPassword = "MF_MAIL_PASSWORD" | ||
envMailFromAddress = "MF_MAIL_FROM_ADDRESS" | ||
envMailFromName = "MF_MAIL_FROM_NAME" | ||
envMailLogLevel = "MF_MAIL_LOG_LEVEL" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that these should be in the cmd/users/main.go
users/mail/mail.go
Outdated
|
||
a.log = logger | ||
}) | ||
return a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the env vars should be loaded in the main. You can create a separate mail config structure here and pass this mail config as method parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, but this way mail can be reused in any other service with just calling mail.Send and providing environment variables, no need to handle configs in main of the service
users/token/token.go
Outdated
return email, nil | ||
} | ||
|
||
// // SendToken sends password recovery link to user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove dead code
users/token/token.go
Outdated
|
||
type tokenizer struct { | ||
hmacSampleSecret []byte // secret for signing token | ||
tokenDuration int //token in duration in min |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add space after //
0074eb9
to
462e0ed
Compare
30f5842
to
aeccf9a
Compare
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
a76c857
to
e05a4d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* add users metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add users metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add users metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add users metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add users metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add users metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add users metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add users metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add metadata to users Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add metadata to users Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add metadata to users Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add metadata to users Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add metadata to users Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add metadata to users Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add metadata to users Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add metadata to users Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add metadata to users Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add metadata to users Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add metadata to users Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add default value for metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add default value for metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add default value for metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add default value for metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add default value for metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add default value for metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * when metadata is not set dont save 'null' string Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * when metadata is not set dont save 'null' string Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * when metadata is not set dont save 'null' string Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * change metadata type, add error handling Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * change metadata type, add error handling Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * change metadata type, add error handling Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * remove extra char Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * remove extra char Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * remove extra char Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * few small fixes Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * few small fixes Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * few small fixes Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix identityRes Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix identityRes Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix identityRes Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add users metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add users metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add users metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * password reset, sketching Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * password reset, sketching Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * password reset, sketching Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * password reset, sketching Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * password reset, sketching Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * password reset, sketching Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * password reset, sketching Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * password reset, sketching Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * password reset, sketching Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * password reset, sketching Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * password reset, sketching Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * password reset, sketching Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * mail Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * mail Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * reset request endpoint Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * reset request endpoint Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * reset request endpoint Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add token Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add token Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add token Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add token methods Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add token methods Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add token methods Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding token endpoints Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding token endpoints Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding token endpoints Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding reset passw endpoint Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding reset passw endpoint Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding reset passw endpoint Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add logic for token verifying Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add logic for token verifying Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add logic for token verifying Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * remove mail from main Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * remove mail from main Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * remove mail from main Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * token and passwd update logic Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * token and passwd update logic Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * token and passwd update logic Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * reorganize mailing code Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add comments for password reset flow Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add comments for password reset flow Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * change struct members to private Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * small changes Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * small changes Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * small changes Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add space Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add space Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add space Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * revert back changes used for testing Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * revert back changes used for testing Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * revert back changes used for testing Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * reorganize endpoints, extract host for link from Referer Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * reorganize endpoints, extract host for link from Referer Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding swagger docs for reset passw Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding swagger docs for reset passw Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix imports and some typos Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix imports and some typos Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding swagger docs for reset passw Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * reorganize endpoints, extract host for link from Referer Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * reorganize endpoints, extract host for link from Referer Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * addint test and update swagger for pass reset Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * addint test and update swagger for pass reset Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * addint test and update swagger for pass reset Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding test for endpoint Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding test for endpoint Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding test for endpoint Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding test for endpoint Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding endpoint test Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding endpoint test Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding endpoint test Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * change token generation Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * change token generation Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * change token generation Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * reorganize and change token gen Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * reorganize and change token gen Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * reorganize and change token gen Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * addint token and mail Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding token env Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding token env Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix error reporting Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix some comments and update readme Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix some comments and update readme Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix some comments and update readme Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * update readme Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix problmes due merge Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix problmes due merge Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix typos Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix typos Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add trusted certificates Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add endpoint for password change of currently authenticated user Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add env variable for conf reset endpoint Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add metadata to users Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add default value for metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add default value for metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * when metadata is not set dont save 'null' string Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * change metadata type, add error handling Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * remove extra char Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * few small fixes Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix identityRes Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add users metadata Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * password reset, sketching Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * password reset, sketching Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * password reset, sketching Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * password reset, sketching Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * reset request endpoint Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding token endpoints Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding reset passw endpoint Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add logic for token verifying Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * remove mail from main Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * small changes Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add space Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * revert back changes used for testing Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * reorganize endpoints, extract host for link from Referer Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * reorganize endpoints, extract host for link from Referer Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * addint test and update swagger for pass reset Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * adding endpoint test Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix some comments and update readme Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add env variable for conf reset endpoint Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix tests Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * resolving some style comments Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * minor fixes due to bad merge Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix problem with unsigned commits Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix problem with unsigned commits Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix call to users.New Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix call to users.New Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * rename file Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * rename to email.go Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * additional comments Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * additional comments Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * refactor email util Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * refactor email util Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * refactor email util Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * refactor email util Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * remove debug bin Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add driver conf for mail Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * refactor email Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * refactor email Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix failing tests Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add testify Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * small fix Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add token conf Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * small fix Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * small fix Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * configurable email template Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix missing var Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add env for email template file Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add env for email template file Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix tests Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix test Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix test Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * revert to master Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * remove dev container Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * small fixes, typos, namings Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix typo Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * resolving comments Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * resolving comments Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * resolving comments Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * resolving comments Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * resolving comments Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add line Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * return err from email New() Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * change MF_TOKEN_RESET_ENDPOINT Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add and remove env vars Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * separate password logic into two methods Change and Reset Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * update comments Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * remove blank line Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * update docs Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * dont use camel case Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * small fix Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * reorganize email template for passw reset Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * reorganize email template for passw reset Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
What does this do?
adding endpoints for password resetting flow
Adds an endpoint for changing password of currently authenticated user
Which issue(s) does this PR fix/relate to?
Resolves #532
( option 1. from https://github.com/mainflux/mainflux/issues/532#issuecomment-450579158)