Skip to content

Commit 07b72e2

Browse files
committed
resolved all the bugs
1 parent 9dcc403 commit 07b72e2

7 files changed

Lines changed: 33 additions & 45 deletions

File tree

cmd/add/accessRestriction/accessRestriction.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ func NewaccessRestrictionCmd() *cobra.Command {
6666

6767
func addAccessRestriction(opts *accessRestrictionObj) error {
6868
if opts.BlacklistDomain != "" || opts.WhitelistDomain != "" {
69-
addDomian( opts.WhitelistDomain, opts.BlacklistDomain)
69+
return addDomian( opts.WhitelistDomain, opts.BlacklistDomain)
7070
} else if opts.AllowedIP != "" || opts.DeniedIP != "" {
71-
addIpOrIpRange(opts.AllowedIP, opts.DeniedIP)
71+
return addIpOrIpRange(opts.AllowedIP, opts.DeniedIP)
7272
} else {
7373
fmt.Println("Must use one of the following flags:")
7474
fmt.Println("--blacklist-domain/whitelist-domain: To add either blacklist or whitelist Domain/Email")

cmd/delete/accessRestriction/accessRestriction.go

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,24 +80,12 @@ func NewaccessRestrictionCmd() *cobra.Command {
8080
if len(newDomains) == 0 {
8181
resp.ListType = "none"
8282
}
83-
deleteDomain(resp.ListType, newDomains)
83+
return deleteDomain(resp.ListType, newDomains)
8484

8585

8686
} else if opts.AllowedIP != "" || opts.DeniedIP != "" {
8787

88-
if opts.AllowedIP != "" {
89-
isValid, err := cmdutil.ValidateIPorIPRange(opts.AllowedIP)
90-
if err != nil && !isValid {
91-
fmt.Println("Error :" + err.Error())
92-
return nil
93-
}
94-
} else if opts.DeniedIP != "" {
95-
isValid, err := cmdutil.ValidateIPorIPRange(opts.DeniedIP)
96-
if err != nil && !isValid {
97-
fmt.Println("Error :" + err.Error())
98-
return nil
99-
}
100-
}
88+
10189

10290
siteFeatures, err := api.GetSiteFeatures()
10391
if err != nil {
@@ -150,7 +138,7 @@ func NewaccessRestrictionCmd() *cobra.Command {
150138
break
151139
}
152140
}
153-
deleteIP(ipRestrictionType,newIPList)
141+
return deleteIP(ipRestrictionType,newIPList)
154142

155143
}else if *allDomain {
156144
var AddEmail api.EmailWhiteBLackListSchema

cmd/get/accessRestriction/accessRestriction.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ Allowed/Denied IP or IP Range
4242
return nil
4343
}
4444
if *domain {
45-
GetDomainEmailList()
45+
return GetDomainEmailList()
4646
} else if *ip {
47-
GetIPList()
47+
return GetIPList()
4848
} else {
4949
fmt.Println("Must use one of the following flags:")
5050
fmt.Println("--domain: To get the list of domains")
@@ -64,10 +64,7 @@ Allowed/Denied IP or IP Range
6464

6565
func GetDomainEmailList() error {
6666
resp, err := api.GetEmailWhiteListBlackList()
67-
if err != nil && err.Error() == "No records found"{
68-
fmt.Println(err.Error())
69-
return nil
70-
}
67+
7168
if err != nil {
7269
return err
7370
}

cmd/login/login.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func doLogin() error {
9898
if err != nil {
9999
return err
100100
}
101-
101+
fmt.Println("Fetching Permissions....")
102102
err = api.GetPermissionsfromAPI()
103103
if err != nil {
104104
return err

cmd/resetSecret/resetSecret.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func reset() error {
8686
if err != nil {
8787
return err
8888
}
89-
fmt.Println("API Secret reset successfully")
89+
fmt.Println("The API Secret has been successfully reset.")
9090

9191
return nil
9292
}

cmd/set/smtpConfiguration/smtpConfiguration.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func NewsmtpConfigurationCmd() *cobra.Command {
2929
Example: heredoc.Doc(`
3030
# SMTP Provider's Names we can use in set commands
3131
# Mailazy, AmazonSES-USEast, AmazonSES-USWest, AmazonSES-EU, Gmail,
32-
Mandrill, Rackspace-mailgun, SendGrid, Yahoo, Other
32+
Mandrill, Rackspace-mailgun, SendGrid, Yahoo, CustomSMTPProviders
3333
$ lr set smtp-configuration -p Mailazy
3434
? Key: <Key>
3535
? Secret: <Secret>

cmdutil/constant.go

Lines changed: 22 additions & 19 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)