Skip to content
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

Merged
merged 214 commits into from
Oct 22, 2019
Merged

MF-532 - Password reset #873

merged 214 commits into from
Oct 22, 2019

Conversation

mteodor
Copy link
Contributor

@mteodor mteodor commented Sep 30, 2019

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)

@mteodor mteodor requested a review from a team as a code owner September 30, 2019 14:16
@mteodor mteodor changed the title NOISSUE - Password change MF-532 - Password change Oct 1, 2019
@codecov-io
Copy link

codecov-io commented Oct 4, 2019

Codecov Report

Merging #873 into master will decrease coverage by 0.91%.
The diff coverage is 62.31%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
users/users.go 68.42% <ø> (ø) ⬆️
users/postgres/users.go 54.54% <0%> (-17.46%) ⬇️
users/api/http/responses.go 66.66% <100%> (+16.66%) ⬆️
users/api/http/endpoint.go 86.2% <100%> (+18.2%) ⬆️
users/service.go 28.57% <5%> (-33.93%) ⬇️
users/api/http/requests.go 61.53% <70%> (+28.2%) ⬆️
users/token/token.go 71.42% <71.42%> (ø)
users/api/http/transport.go 82.08% <84.37%> (+1.8%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6687a73...d48d556. Read the comment docs.

things/swagger.yaml Outdated Show resolved Hide resolved
users/api/http/transport.go Outdated Show resolved Hide resolved
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct successful.

// 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
Copy link
Contributor

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/endpoint.go Outdated Show resolved Hide resolved

type resetPassRes struct {
Msg string `json:"msg"`
Error string `json:"error"`
Copy link
Contributor

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.

Copy link
Contributor Author

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/api/http/endpoint.go Outdated Show resolved Hide resolved
}
db := struct {
Email string
Token string
Copy link
Contributor

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.

type resetTokenReq struct {
Token string
Email string
Password string
Copy link
Contributor

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.

Copy link
Collaborator

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.


type passwResetReq struct {
Email string
Host string
Copy link
Contributor

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.

Copy link
Collaborator

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 ?

Copy link
Contributor Author

@mteodor mteodor Oct 8, 2019

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/api/http/transport.go Outdated Show resolved Hide resolved
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
Copy link
Contributor

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.

Copy link
Collaborator

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 Show resolved Hide resolved
Password string
Token string
}{}
// this probably needs to be moved somwhere else
Copy link
Contributor

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/api/http/endpoint_test.go Outdated Show resolved Hide resolved
users/api/http/transport.go Outdated Show resolved Hide resolved
users/mail/mail.go Outdated Show resolved Hide resolved
users/service.go Outdated Show resolved Hide resolved
users/service.go Outdated
ErrRetrievingRecoveryToken = errors.New("error deleting recovery token")

// ErrMisingResetToken indicates malformed or missing reset token
// for reseting password.
Copy link
Contributor

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 Show resolved Hide resolved
users/service.go Outdated
@@ -51,6 +77,13 @@ type Service interface {

// Get authenticated user info for the given token.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No fullstop

users/token/token.go Outdated Show resolved Hide resolved
users/api/http/endpoint_test.go Outdated Show resolved Hide resolved
users/mail/mail.go Outdated Show resolved Hide resolved
Comment on lines 85 to 91
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}
Copy link
Contributor

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
Comment on lines 37 to 43
| 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 | |
Copy link
Contributor

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
Comment on lines 79 to 86
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]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

@mteodor mteodor changed the title MF-532 - Password change MF-532 - Password reset Oct 9, 2019
users/mail/mail.go Outdated Show resolved Hide resolved
users/mail/mail.go Outdated Show resolved Hide resolved
.env Outdated Show resolved Hide resolved
users/mail/mail.go Outdated Show resolved Hide resolved
.env Outdated Show resolved Hide resolved
users/README.md Show resolved Hide resolved
users/README.md Show resolved Hide resolved
users/api/http/endpoint_test.go Outdated Show resolved Hide resolved
users/api/http/responses.go Outdated Show resolved Hide resolved
users/mail/mail.go Outdated Show resolved Hide resolved
users/service.go Outdated
}

func (svc usersService) GenerateResetToken(ctx context.Context, email, host string) error {

Copy link
Contributor

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/mocks/users.go Outdated Show resolved Hide resolved
tools/mqtt-bench/client.go Outdated Show resolved Hide resolved
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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please correct this comment

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put a space behind //

users/api/http/endpoint_test.go Outdated Show resolved Hide resolved
users/api/http/endpoint.go Outdated Show resolved Hide resolved
users/api/http/endpoint.go Outdated Show resolved Hide resolved
users/api/http/endpoint.go Outdated Show resolved Hide resolved
users/api/http/transport.go Outdated Show resolved Hide resolved
envMailPassword = "MF_MAIL_PASSWORD"
envMailFromAddress = "MF_MAIL_FROM_ADDRESS"
envMailFromName = "MF_MAIL_FROM_NAME"
envMailLogLevel = "MF_MAIL_LOG_LEVEL"
Copy link
Contributor

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


a.log = logger
})
return a
Copy link
Contributor

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.

Copy link
Contributor Author

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/service.go Outdated Show resolved Hide resolved
users/service.go Outdated Show resolved Hide resolved
users/token/token.go Show resolved Hide resolved
return email, nil
}

// // SendToken sends password recovery link to user
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove dead code


type tokenizer struct {
hmacSampleSecret []byte // secret for signing token
tokenDuration int //token in duration in min
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add space after //

@mteodor mteodor force-pushed the password-change branch 3 times, most recently from 0074eb9 to 462e0ed Compare October 13, 2019 13:27
@mteodor mteodor force-pushed the password-change branch 2 times, most recently from 30f5842 to aeccf9a Compare October 13, 2019 13:50
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>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
manuio
manuio previously approved these changes Oct 22, 2019
Copy link
Contributor

@manuio manuio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

dborovcanin
dborovcanin previously approved these changes Oct 22, 2019
dborovcanin
dborovcanin previously approved these changes Oct 22, 2019
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
anovakovic01
anovakovic01 previously approved these changes Oct 22, 2019
Copy link
Contributor

@anovakovic01 anovakovic01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

configs/resetPasswEmail.tmpl Show resolved Hide resolved
users/api/http/endpoint.go Show resolved Hide resolved
users/emailer/emailer.go Outdated Show resolved Hide resolved
users/service.go Outdated Show resolved Hide resolved
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Copy link
Contributor

@manuio manuio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@manuio manuio merged commit f4f938a into absmach:master Oct 22, 2019
@mteodor mteodor deleted the password-change branch September 22, 2020 10:37
manuio pushed a commit that referenced this pull request Oct 12, 2020
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants