Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dfss
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mpcs
dfss
Commits
ab8cd887
Commit
ab8cd887
authored
Mar 28, 2016
by
Loïck Bonniot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[gui][c] Improve error messages
parent
f20e3606
Pipeline
#405
passed with stage
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
34 additions
and
10 deletions
+34
-10
dfssc/common/errors.go
dfssc/common/errors.go
+1
-1
dfssc/common/errors_test.go
dfssc/common/errors_test.go
+1
-1
dfssc/user/authentication.go
dfssc/user/authentication.go
+7
-6
dfssc/user/register.go
dfssc/user/register.go
+2
-1
gui/authform/authform.ui
gui/authform/authform.ui
+14
-1
gui/main.go
gui/main.go
+3
-0
gui/userform/userform.ui
gui/userform/userform.ui
+6
-0
No files found.
dfssc/common/errors.go
View file @
ab8cd887
...
...
@@ -21,5 +21,5 @@ func EvaluateErrorCodeResponse(code *api.ErrorCode) error {
if
len
(
code
.
Message
)
==
0
{
return
errors
.
New
(
"Received error code "
+
(
code
.
Code
)
.
String
())
}
return
errors
.
New
(
"Received error code "
+
(
code
.
Code
)
.
String
()
+
": "
+
code
.
Message
)
return
errors
.
New
(
code
.
Message
)
}
dfssc/common/errors_test.go
View file @
ab8cd887
...
...
@@ -46,5 +46,5 @@ func TestEvaluateErrorCodeResponse(t *testing.T) {
}
err
=
EvaluateErrorCodeResponse
(
otherWithMessage
)
assert
.
Equal
(
t
,
"
Received error code INVARG:
Invalid mail"
,
err
.
Error
())
assert
.
Equal
(
t
,
"Invalid mail"
,
err
.
Error
())
}
dfssc/user/authentication.go
View file @
ab8cd887
package
user
import
(
"dfss/dfssc/common"
"dfss/dfssc/security"
pb
"dfss/dfssp/api"
"errors"
"io/ioutil"
"regexp"
"time"
"dfss/dfssc/common"
"dfss/dfssc/security"
pb
"dfss/dfssp/api"
"errors"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
// AuthManager handles the authentication of a user
...
...
@@ -102,11 +103,11 @@ func (m *AuthManager) sendRequest() (*pb.RegisteredUser, error) {
}
// Stop the context if it takes too long for the platform to answer
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
TODO
(),
10
*
time
.
Second
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
10
*
time
.
Second
)
defer
cancel
()
response
,
err
:=
client
.
Auth
(
ctx
,
request
)
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
ors
.
New
(
grpc
.
ErrorDesc
(
err
))
}
return
response
,
nil
...
...
dfssc/user/register.go
View file @
ab8cd887
...
...
@@ -9,6 +9,7 @@ import (
"dfss/dfssc/security"
pb
"dfss/dfssp/api"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
// RegisterManager handles the registration of a user
...
...
@@ -153,7 +154,7 @@ func (m *RegisterManager) sendRequest(certRequest string) (*pb.ErrorCode, error)
defer
cancel
()
response
,
err
:=
client
.
Register
(
ctx
,
request
)
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
ors
.
New
(
grpc
.
ErrorDesc
(
err
))
}
return
response
,
nil
...
...
gui/authform/authform.ui
View file @
ab8cd887
...
...
@@ -81,13 +81,26 @@
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"tokenField"
/>
<widget
class=
"QLineEdit"
name=
"tokenField"
>
<property
name=
"autoFillBackground"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QPushButton"
name=
"authButton"
>
<property
name=
"text"
>
<string>
Authenticate
</string>
</property>
<property
name=
"autoDefault"
>
<bool>
false
</bool>
</property>
<property
name=
"default"
>
<bool>
true
</bool>
</property>
<property
name=
"flat"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item
row=
"1"
column=
"1"
>
...
...
gui/main.go
View file @
ab8cd887
...
...
@@ -46,5 +46,8 @@ func main() {
w
.
SetWindowTitle
(
"DFSS Client v"
+
dfss
.
Version
)
w
.
SetFixedSizeWithWidthHeight
(
WIDTH
,
HEIGHT
)
w
.
Show
()
ev
:=
ui
.
NewCloseEvent
()
w
.
CloseEvent
(
ev
)
})
}
gui/userform/userform.ui
View file @
ab8cd887
...
...
@@ -152,6 +152,12 @@
<property
name=
"text"
>
<string>
Register
</string>
</property>
<property
name=
"autoDefault"
>
<bool>
false
</bool>
</property>
<property
name=
"default"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item
row=
"3"
column=
"1"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment