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
Init pwd #88
Conversation
Pull Request Test Coverage Report for Build 842
💛 - Coveralls |
pkg/management/component.go
Outdated
@@ -490,9 +490,14 @@ func (c *component) ExecuteActionsEmail(ctx context.Context, realmName string, u | |||
var accessToken = ctx.Value(cs.CtContextAccessToken).(string) | |||
|
|||
var actions = []string{} | |||
var init_password_action = "sms-password-set" |
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 might have a go-lint recommandation asking not to use underscore in variable names. initPasswordAction would be more Go-compliant
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.
Hahaha, only now I noticed how I named this variable (Friday tiredness) :))).
Thanks, good point.
pkg/management/component.go
Outdated
@@ -474,8 +474,8 @@ func (c *component) ResetPassword(ctx context.Context, realmName string, userID | |||
} | |||
|
|||
//store the API call into the DB | |||
// the error should be treated | |||
_ = c.reportEvent(ctx, "INIT_PASSWORD", database.CtEventRealmName, realmName, database.CtEventUserID, userID) | |||
//_ = c.reportEvent(ctx, "INIT_PASSWORD", database.CtEventRealmName, realmName, database.CtEventUserID, userID) |
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 not used, you'd better completely remove this block
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 prefer to leave it as I don't know if the back office will start using it or not soon
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
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 we decide to leave the functionality, I would suggest to also leave the reportEvent.
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.
done
pkg/management/component_test.go
Outdated
@@ -1281,8 +1281,8 @@ func TestExecuteActionsEmail(t *testing.T) { | |||
var accessToken = "TOKEN==" | |||
var realmName = "master" | |||
var userID = "1245-7854-8963" | |||
var reqActions = []api.RequiredAction{"action1", "action2"} | |||
var actions = []string{"action1", "action2"} | |||
var reqActions = []api.RequiredAction{"sms-password-set", "action1", "action2"} |
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 you move init_password_action declaration in a const (...) block at the beginning of component.go, you could reuse it here and prevent potential mis-spelling.
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.
Done
pkg/management/component.go
Outdated
@@ -474,8 +474,8 @@ func (c *component) ResetPassword(ctx context.Context, realmName string, userID | |||
} | |||
|
|||
//store the API call into the DB | |||
// the error should be treated | |||
_ = c.reportEvent(ctx, "INIT_PASSWORD", database.CtEventRealmName, realmName, database.CtEventUserID, userID) | |||
//_ = c.reportEvent(ctx, "INIT_PASSWORD", database.CtEventRealmName, realmName, database.CtEventUserID, userID) |
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 we decide to leave the functionality, I would suggest to also leave the reportEvent.
added INIT_PASSWORD event when a support user calls the API execute-actions-email with the action sms-password-set