Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
b49b7bc1
Commit
b49b7bc1
authored
Aug 21, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Warn users when their keys are invalid
parent
b0f982fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
app/helpers/form_helper.rb
app/helpers/form_helper.rb
+3
-2
app/views/profiles/keys/_key.html.haml
app/views/profiles/keys/_key.html.haml
+7
-1
app/views/profiles/keys/_key_details.html.haml
app/views/profiles/keys/_key_details.html.haml
+1
-0
No files found.
app/helpers/form_helper.rb
View file @
b49b7bc1
module
FormHelper
def
form_errors
(
model
)
def
form_errors
(
model
,
headline
=
'The form contains the following'
)
return
unless
model
.
errors
.
any?
pluralized
=
'error'
.
pluralize
(
model
.
errors
.
count
)
headline
=
"The form contains the following
#{
pluralized
}
:"
headline
=
headline
+
' '
+
pluralized
+
':'
content_tag
(
:div
,
class:
'alert alert-danger'
,
id:
'error_explanation'
)
do
content_tag
(
:h4
,
headline
)
<<
...
...
app/views/profiles/keys/_key.html.haml
View file @
b49b7bc1
%li
.key-list-item
.pull-left.append-right-10
=
icon
'key'
,
class:
"settings-list-icon hidden-xs"
-
if
key
.
valid?
=
icon
'key'
,
class:
'settings-list-icon hidden-xs'
-
else
=
icon
'exclamation-triangle'
,
class:
'settings-list-icon hidden-xs'
,
title:
'The key is disabled because it is invalid'
.key-list-item-info
=
link_to
path_to_key
(
key
,
is_admin
),
class:
"title"
do
=
key
.
title
...
...
app/views/profiles/keys/_key_details.html.haml
View file @
b49b7bc1
...
...
@@ -16,6 +16,7 @@
%strong
=
@key
.
last_used_at
.
try
(
:to_s
,
:medium
)
||
'N/A'
.col-md-8
=
form_errors
(
@key
,
'The key has the following'
)
unless
@key
.
valid?
%p
%span
.light
Fingerprint:
%code
.key-fingerprint
=
@key
.
fingerprint
...
...
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