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
f48f51ac
Commit
f48f51ac
authored
Feb 29, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Account settings
Closes #13854
parent
f7da99ae
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
200 additions
and
116 deletions
+200
-116
app/assets/javascripts/profile.js.coffee
app/assets/javascripts/profile.js.coffee
+4
-3
app/assets/stylesheets/framework/common.scss
app/assets/stylesheets/framework/common.scss
+3
-1
app/assets/stylesheets/framework/variables.scss
app/assets/stylesheets/framework/variables.scss
+2
-2
app/assets/stylesheets/pages/profile.scss
app/assets/stylesheets/pages/profile.scss
+44
-4
app/controllers/profiles/accounts_controller.rb
app/controllers/profiles/accounts_controller.rb
+24
-0
app/views/profiles/accounts/show.html.haml
app/views/profiles/accounts/show.html.haml
+123
-106
No files found.
app/assets/javascripts/profile.js.coffee
View file @
f48f51ac
...
@@ -4,12 +4,13 @@ class @Profile
...
@@ -4,12 +4,13 @@ class @Profile
$
(
'.js-preferences-form'
).
on
'change.preference'
,
'input[type=radio]'
,
->
$
(
'.js-preferences-form'
).
on
'change.preference'
,
'input[type=radio]'
,
->
$
(
this
).
parents
(
'form'
).
submit
()
$
(
this
).
parents
(
'form'
).
submit
()
$
(
'.update-username
form
'
).
on
'ajax:before'
,
->
$
(
'.update-username'
).
on
'ajax:before'
,
->
$
(
'.loading-
gif
'
).
show
()
$
(
'.loading-
username
'
).
show
()
$
(
this
).
find
(
'.update-success'
).
hide
()
$
(
this
).
find
(
'.update-success'
).
hide
()
$
(
this
).
find
(
'.update-failed'
).
hide
()
$
(
this
).
find
(
'.update-failed'
).
hide
()
$
(
'.update-username form'
).
on
'ajax:complete'
,
->
$
(
'.update-username'
).
on
'ajax:complete'
,
->
$
(
'.loading-username'
).
hide
()
$
(
this
).
find
(
'.btn-save'
).
enable
()
$
(
this
).
find
(
'.btn-save'
).
enable
()
$
(
this
).
find
(
'.loading-gif'
).
hide
()
$
(
this
).
find
(
'.loading-gif'
).
hide
()
...
...
app/assets/stylesheets/framework/common.scss
View file @
f48f51ac
...
@@ -12,11 +12,13 @@
...
@@ -12,11 +12,13 @@
.prepend-top-default
{
margin-top
:
$gl-padding
!
important
;
}
.prepend-top-default
{
margin-top
:
$gl-padding
!
important
;
}
.prepend-top-20
{
margin-top
:
20px
}
.prepend-top-20
{
margin-top
:
20px
}
.prepend-left-10
{
margin-left
:
10px
}
.prepend-left-10
{
margin-left
:
10px
}
.prepend-left-default
{
margin-left
:
$gl-padding
}
.prepend-left-default
{
margin-left
:
$gl-padding
;
}
.prepend-left-20
{
margin-left
:
20px
}
.prepend-left-20
{
margin-left
:
20px
}
.append-right-5
{
margin-right
:
5px
}
.append-right-5
{
margin-right
:
5px
}
.append-right-10
{
margin-right
:
10px
}
.append-right-10
{
margin-right
:
10px
}
.append-right-default
{
margin-right
:
$gl-padding
;
}
.append-right-20
{
margin-right
:
20px
}
.append-right-20
{
margin-right
:
20px
}
.append-bottom-0
{
margin-bottom
:
0
}
.append-bottom-10
{
margin-bottom
:
10px
}
.append-bottom-10
{
margin-bottom
:
10px
}
.append-bottom-15
{
margin-bottom
:
15px
}
.append-bottom-15
{
margin-bottom
:
15px
}
.append-bottom-20
{
margin-bottom
:
20px
}
.append-bottom-20
{
margin-bottom
:
20px
}
...
...
app/assets/stylesheets/framework/variables.scss
View file @
f48f51ac
...
@@ -70,7 +70,7 @@ $orange-light: rgba(252, 109, 38, 0.80);
...
@@ -70,7 +70,7 @@ $orange-light: rgba(252, 109, 38, 0.80);
$orange-normal
:
#E75E40
;
$orange-normal
:
#E75E40
;
$orange-dark
:
#CE5237
;
$orange-dark
:
#CE5237
;
$red-light
:
#F
43263
;
$red-light
:
#F
06559
;
$red-normal
:
#E52C5A
;
$red-normal
:
#E52C5A
;
$red-dark
:
#D22852
;
$red-dark
:
#D22852
;
...
@@ -94,7 +94,7 @@ $border-orange-light: #fc6d26;
...
@@ -94,7 +94,7 @@ $border-orange-light: #fc6d26;
$border-orange-normal
:
#CE5237
;
$border-orange-normal
:
#CE5237
;
$border-orange-dark
:
#C14E35
;
$border-orange-dark
:
#C14E35
;
$border-red-light
:
#
E52C5A
;
$border-red-light
:
#
F24F41
;
$border-red-normal
:
#D22852
;
$border-red-normal
:
#D22852
;
$border-red-dark
:
#CA264F
;
$border-red-dark
:
#CA264F
;
...
...
app/assets/stylesheets/pages/profile.scss
View file @
f48f51ac
.account-page
{
.profile-avatar-form-option
{
fieldset
{
hr
{
margin-bottom
:
15px
;
margin
:
10px
0
;
padding-bottom
:
15px
;
}
}
}
}
...
@@ -175,3 +174,44 @@
...
@@ -175,3 +174,44 @@
color
:
$profile-settings-link-color
;
color
:
$profile-settings-link-color
;
}
}
}
}
.change-username-title
{
color
:
#FC6D26
;
}
.remove-account-title
{
color
:
#F00
;
}
.provider-btn-group
{
display
:
inline-block
;
margin-right
:
10px
;
border
:
1px
solid
#E5E5E5
;
border-radius
:
3px
;
&
:last-child
{
margin-right
:
0
;
}
}
.provider-btn-image
{
display
:
inline-block
;
padding
:
5px
10px
;
border-right
:
1px
solid
#E5E5E5
;
>
img
{
width
:
20px
;
}
}
.provider-btn
{
display
:
inline-block
;
padding
:
5px
10px
;
margin-left
:
-3px
;
line-height
:
22px
;
background-color
:
$gray-light
;
&
.not-active
{
color
:
#4688F1
;
}
}
app/controllers/profiles/accounts_controller.rb
View file @
f48f51ac
class
Profiles::AccountsController
<
Profiles
::
ApplicationController
class
Profiles::AccountsController
<
Profiles
::
ApplicationController
def
show
def
show
unless
current_user
.
otp_secret
current_user
.
otp_secret
=
User
.
generate_otp_secret
(
32
)
end
unless
current_user
.
otp_grace_period_started_at
&&
two_factor_grace_period
current_user
.
otp_grace_period_started_at
=
Time
.
current
end
current_user
.
save!
if
current_user
.
changed?
@user
=
current_user
@user
=
current_user
@qr_code
=
build_qr_code
end
end
def
unlink
def
unlink
...
@@ -8,4 +20,16 @@ class Profiles::AccountsController < Profiles::ApplicationController
...
@@ -8,4 +20,16 @@ class Profiles::AccountsController < Profiles::ApplicationController
current_user
.
identities
.
find_by
(
provider:
provider
).
destroy
current_user
.
identities
.
find_by
(
provider:
provider
).
destroy
redirect_to
profile_account_path
redirect_to
profile_account_path
end
end
private
def
build_qr_code
issuer
=
"
#{
issuer_host
}
|
#{
current_user
.
email
}
"
uri
=
current_user
.
otp_provisioning_uri
(
current_user
.
email
,
issuer:
issuer
)
RQRCode
::
render_qrcode
(
uri
,
:svg
,
level: :m
,
unit:
3
)
end
def
issuer_host
Gitlab
.
config
.
gitlab
.
host
end
end
end
app/views/profiles/accounts/show.html.haml
View file @
f48f51ac
...
@@ -5,109 +5,125 @@
...
@@ -5,109 +5,125 @@
.alert.alert-info
.alert.alert-info
Some options are unavailable for LDAP accounts
Some options are unavailable for LDAP accounts
.account-page.prepend-top-default
.row.prepend-top-default
.panel.panel-default.update-token
.col-lg-3.profile-settings-sidebar
.panel-heading
%h4
.prepend-top-0
Reset Private token
Private Token
.panel-body
=
form_for
@user
,
url:
reset_private_token_profile_path
,
method: :put
do
|
f
|
.data
%p
%p
Your private token is used to access application resources without authentication.
Your private token is used to access application resources without authentication.
%br
.col-lg-9
It can be used for atom feeds or the API.
=
form_for
@user
,
url:
reset_private_token_profile_path
,
method: :put
do
|
f
|
%span
.cred
Keep it secret!
%p
.cgray
%p
.cgray
-
if
current_user
.
private_token
-
if
current_user
.
private_token
=
label_tag
"token"
,
"Private token"
,
class:
"label-light"
=
text_field_tag
"token"
,
current_user
.
private_token
,
class:
"form-control"
=
text_field_tag
"token"
,
current_user
.
private_token
,
class:
"form-control"
-
else
-
else
%span
You don`t have one yet. Click generate to fix it.
%span
You don`t have one yet. Click generate to fix it.
%p
.help-block
.form-actions
It can be used for atom feeds or the API. Keep it secret!
.prepend-top-default
-
if
current_user
.
private_token
-
if
current_user
.
private_token
=
f
.
submit
'Reset private token'
,
data:
{
confirm:
"Are you sure?"
},
class:
"btn btn-default"
=
f
.
submit
'Reset private token'
,
data:
{
confirm:
"Are you sure?"
},
class:
"btn btn-default"
-
else
-
else
=
f
.
submit
'Generate'
,
class:
"btn btn-default"
=
f
.
submit
'Generate'
,
class:
"btn btn-default"
%hr
.panel.panel-default
.row.prepend-top-default
.panel-heading
.col-lg-3.profile-settings-sidebar
%h4
.prepend-top-0
Two-factor Authentication
Two-factor Authentication
.panel-body
-
if
current_user
.
two_factor_enabled?
.pull-right
=
link_to
'Disable Two-factor Authentication'
,
profile_two_factor_auth_path
,
method: :delete
,
class:
'btn btn-close btn-sm'
,
data:
{
confirm:
'Are you sure?'
}
%p
.text-success
%strong
Two-factor Authentication is enabled
%p
If you lose your recovery codes you can
%strong
=
succeed
','
do
=
link_to
'generate new ones'
,
codes_profile_two_factor_auth_path
,
method: :post
,
data:
{
confirm:
'Are you sure?'
}
invalidating all previous codes.
-
else
%p
%p
Increase your account's security by enabling two-factor authentication (2FA).
Increase your account's security by enabling two-factor authentication (2FA).
.col-lg-9
%p
%p
Each time you log in you’ll be required to provide your username and
Status:
#{
current_user
.
two_factor_enabled?
?
'enabled'
:
'disabled'
}
password as usual, plus a randomly-generated code from your phone.
-
if
!
current_user
.
two_factor_enabled?
%p
.form-actions
Download the Google Authenticator application from App Store for iOS or Google Play for Android and scan this code.
=
link_to
'Enable Two-factor Authentication'
,
new_profile_two_factor_auth_path
,
class:
'btn btn-success'
More information is available in the
#{
link_to
(
'documentation'
,
help_page_path
(
'profile'
,
'two_factor_authentication'
))
}
.
.row.append-bottom-10
-
if
button_based_providers
.
any?
.col-md-3
.panel.panel-default
=
raw
@qr_code
.panel-heading
.col-md-9
.account-well
%p
.prepend-top-0.append-bottom-0
Can't scan the code?
%p
.prepend-top-0.append-bottom-0
To add the entry manually, provide the following details to the application on your phone.
%p
.prepend-top-0.append-bottom-0
Account:
=
current_user
.
email
%p
.prepend-top-0.append-bottom-0
Key:
=
current_user
.
otp_secret
.
scan
(
/.{4}/
).
join
(
' '
)
%p
.two-factor-new-manual-content
Time based: Yes
=
form_for
@user
,
url:
""
,
method: :put
do
|
f
|
.form-group
=
label_tag
:pin_code
,
nil
,
class:
"label-light"
=
text_field_tag
:pin_code
,
nil
,
class:
"form-control"
,
required:
true
.prepend-top-default
=
submit_tag
'Enable two-factor authentication'
,
class:
'btn btn-success'
%hr
-
if
button_based_providers
.
any?
.row.prepend-top-default
.col-lg-3.profile-settings-sidebar
%h4
.prepend-top-0
Social sign-in
%p
Activate signin with one of the following services
.col-lg-9
%label
.label-light
Connected Accounts
Connected Accounts
.panel-body
.oauth-buttons.append-bottom-10
%p
Click on icon to activate signin with one of the following services
%p
Click on icon to activate signin with one of the following services
-
button_based_providers
.
each
do
|
provider
|
-
button_based_providers
.
each
do
|
provider
|
.
btn-group
.provider-
btn-group
=
link_to
provider_image_tag
(
provider
),
user_omniauth_authorize_path
(
provider
),
method: :post
,
class:
"btn btn-lg
#{
'active'
if
auth_active?
(
provider
)
}
"
,
"data-no-turbolink"
=>
"true"
.provider-btn-image
=
provider_image_tag
(
provider
)
-
if
auth_active?
(
provider
)
-
if
auth_active?
(
provider
)
=
link_to
unlink_profile_account_path
(
provider:
provider
),
method: :delete
,
class:
'btn btn-lg'
do
=
link_to
unlink_profile_account_path
(
provider:
provider
),
method: :delete
,
class:
'provider-btn'
do
=
icon
(
'close'
)
Disconnect
-
else
-
if
current_user
.
can_change_username?
=
link_to
user_omniauth_authorize_path
(
provider
),
method: :post
,
class:
"provider-btn
#{
'not-active'
if
!
auth_active?
(
provider
)
}
"
,
"data-no-turbolink"
=>
"true"
do
.panel.panel-warning.update-username
Connect
.panel-heading
%hr
Change Username
-
if
current_user
.
can_change_username?
.panel-body
.row.prepend-top-default
=
form_for
@user
,
url:
update_username_profile_path
,
method: :put
,
remote:
true
do
|
f
|
.col-lg-3.profile-settings-sidebar
%h4
.prepend-top-0.change-username-title
Change username
%p
%p
Changing your username will change path to all personal projects!
Changing your username will change path to all personal projects!
%div
.col-lg-9
=
form_for
@user
,
url:
update_username_profile_path
,
method: :put
,
remote:
true
,
html:
{
class:
"update-username"
}
do
|
f
|
.form-group
=
f
.
label
:username
,
"Path"
,
class:
"label-light"
.input-group
.input-group
.input-group-addon
.input-group-addon
=
"
#{
root_url
}
u/"
=
"
#{
root_url
}
u/"
=
f
.
text_field
:username
,
required:
true
,
class:
'form-control'
=
f
.
text_field
:username
,
required:
true
,
class:
'form-control'
.help-block
.loading-gif.hide
Current path:
%p
=
"
#{
root_url
}
u/
#{
current_user
.
username
}
"
=
icon
(
'spinner spin'
)
.prepend-top-default
Saving new username
=
f
.
button
class:
"btn btn-warning"
,
type:
"submit"
do
.form-actions
=
icon
"spinner spin"
,
class:
"hidden loading-username"
=
f
.
submit
'Save username'
,
class:
"btn btn-warning"
Update username
%hr
-
if
signup_enabled?
-
if
signup_enabled?
.panel.panel-danger.remove-account
.row.prepend-top-default
.panel-heading
.col-lg-3.profile-settings-sidebar
%h4
.prepend-top-0.remove-account-title
Remove account
Remove account
.panel-body
.col-lg-9
-
if
@user
.
can_be_removed?
-
if
@user
.
can_be_removed?
%p
Deleting an account has the following effects:
%p
Deleting an account has the following effects:
%ul
%ul
%li
All user content like authored issues, snippets, comments will be removed
%li
All user content like authored issues, snippets, comments will be removed
-
rp
=
current_user
.
personal_projects
.
count
-
rp
=
current_user
.
personal_projects
.
count
-
unless
rp
.
zero?
-
unless
rp
.
zero?
%li
#{
pluralize
rp
,
'personal project'
}
will be removed and cannot be restored
%li
#{
pluralize
rp
,
'personal project'
}
will be removed and cannot be restored
.form-actions
=
link_to
'Delete account'
,
user_registration_path
,
data:
{
confirm:
"REMOVE
#{
current_user
.
name
}
? Are you sure?"
},
method: :delete
,
class:
"btn btn-remove"
=
link_to
'Delete account'
,
user_registration_path
,
data:
{
confirm:
"REMOVE
#{
current_user
.
name
}
? Are you sure?"
},
method: :delete
,
class:
"btn btn-remove"
-
else
-
else
-
if
@user
.
solo_owned_groups
.
present?
-
if
@user
.
solo_owned_groups
.
present?
...
@@ -116,3 +132,4 @@
...
@@ -116,3 +132,4 @@
%strong
#{
@user
.
solo_owned_groups
.
map
(
&
:name
).
join
(
', '
)
}
%strong
#{
@user
.
solo_owned_groups
.
map
(
&
:name
).
join
(
', '
)
}
%p
%p
You must transfer ownership or delete these groups before you can delete your account.
You must transfer ownership or delete these groups before you can delete your account.
.append-bottom-default
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