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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
be41d84f
Commit
be41d84f
authored
Dec 14, 2015
by
Drew Blessing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow account unlock via email
parent
b95f7b18
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
35 additions
and
21 deletions
+35
-21
CHANGELOG
CHANGELOG
+1
-0
app/models/user.rb
app/models/user.rb
+1
-0
app/views/devise/mailer/unlock_instructions.html.erb
app/views/devise/mailer/unlock_instructions.html.erb
+0
-7
app/views/devise/mailer/unlock_instructions.html.haml
app/views/devise/mailer/unlock_instructions.html.haml
+10
-0
app/views/devise/unlocks/new.html.erb
app/views/devise/unlocks/new.html.erb
+0
-12
app/views/devise/unlocks/new.html.haml
app/views/devise/unlocks/new.html.haml
+14
-0
config/initializers/devise.rb
config/initializers/devise.rb
+2
-2
db/migrate/20151210030143_add_unlock_token_to_user.rb
db/migrate/20151210030143_add_unlock_token_to_user.rb
+5
-0
db/schema.rb
db/schema.rb
+1
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+1
-0
No files found.
CHANGELOG
View file @
be41d84f
...
...
@@ -19,6 +19,7 @@ v 8.3.0 (unreleased)
- Recognize issue/MR/snippet/commit links as references
- Add ignore whitespace change option to commit view
- Fire update hook from GitLab
- Allow account unlock via email
- Style warning about mentioning many people in a comment
- Fix: sort milestones by due date once again (Greg Smethells)
- Migrate all CI::Services and CI::WebHooks to Services and WebHooks
...
...
app/models/user.rb
View file @
be41d84f
...
...
@@ -26,6 +26,7 @@
# bio :string(255)
# failed_attempts :integer default(0)
# locked_at :datetime
# unlock_token :string(255)
# username :string(255)
# can_create_group :boolean default(TRUE), not null
# can_create_team :boolean default(TRUE), not null
...
...
app/views/devise/mailer/unlock_instructions.html.erb
deleted
100644 → 0
View file @
b95f7b18
<p>
Hello
<%=
@resource
.
email
%>
!
</p>
<p>
Your account has been locked due to an excessive amount of unsuccessful sign in attempts.
</p>
<p>
Click the link below to unlock your account:
</p>
<p>
<%=
link_to
'Unlock your account'
,
unlock_url
(
@resource
,
unlock_token:
@token
)
%>
</p>
app/views/devise/mailer/unlock_instructions.html.haml
0 → 100644
View file @
be41d84f
%p
Hello
#{
@resource
.
name
}
!
%p
Your GitLab account has been locked due to an excessive amount of unsuccessful
sign in attempts. Your account will automatically unlock in
=
time_ago_in_words
(
Devise
.
unlock_in
.
from_now
)
or you may click the link below to unlock now.
%p
=
link_to
'Unlock your account'
,
unlock_url
(
@resource
,
unlock_token:
@token
)
app/views/devise/unlocks/new.html.erb
deleted
100644 → 0
View file @
b95f7b18
<h2>
Resend unlock instructions
</h2>
<%=
form_for
(
resource
,
as:
resource_name
,
url:
unlock_path
(
resource_name
),
html:
{
method: :post
})
do
|
f
|
%>
<%=
devise_error_messages!
%>
<div>
<%=
f
.
label
:email
%>
<br
/>
<%=
f
.
email_field
:email
%>
</div>
<div>
<%=
f
.
submit
"Resend unlock instructions"
%>
</div>
<%
end
%>
<%=
render
partial:
"devise/shared/links"
%>
app/views/devise/unlocks/new.html.haml
0 → 100644
View file @
be41d84f
.login-box
.login-heading
%h3
Resend unlock email
.login-body
=
form_for
(
resource
,
as:
resource_name
,
url:
unlock_path
(
resource_name
),
html:
{
method: :post
})
do
|
f
|
.devise-errors
=
devise_error_messages!
.clearfix.append-bottom-20
=
f
.
email_field
:email
,
class:
'form-control'
,
placeholder:
'Email'
,
autofocus:
'autofocus'
,
autocapitalize:
'off'
,
autocorrect:
'off'
.clearfix
=
f
.
submit
'Resend unlock instructions'
,
class:
'btn btn-success'
.clearfix.prepend-top-20
=
render
'devise/shared/sign_in_link'
config/initializers/devise.rb
View file @
be41d84f
...
...
@@ -121,14 +121,14 @@ Devise.setup do |config|
config
.
lock_strategy
=
:failed_attempts
# Defines which key will be used when locking and unlocking an account
#
config.unlock_keys = [ :email ]
config
.
unlock_keys
=
[
:email
]
# Defines which strategy will be used to unlock an account.
# :email = Sends an unlock link to the user email
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
# :both = Enables both strategies
# :none = No unlock strategy. You should handle unlocking by yourself.
config
.
unlock_strategy
=
:
time
config
.
unlock_strategy
=
:
both
# Number of authentication tries before locking an account if lock_strategy
# is failed attempts.
...
...
db/migrate/20151210030143_add_unlock_token_to_user.rb
0 → 100644
View file @
be41d84f
class
AddUnlockTokenToUser
<
ActiveRecord
::
Migration
def
change
add_column
:users
,
:unlock_token
,
:string
end
end
db/schema.rb
View file @
be41d84f
...
...
@@ -837,6 +837,7 @@ ActiveRecord::Schema.define(version: 20151210125932) do
t
.
integer
"consumed_timestep"
t
.
integer
"layout"
,
default:
0
t
.
boolean
"hide_project_limit"
,
default:
false
t
.
string
"unlock_token"
end
add_index
"users"
,
[
"admin"
],
name:
"index_users_on_admin"
,
using: :btree
...
...
spec/models/user_spec.rb
View file @
be41d84f
...
...
@@ -26,6 +26,7 @@
# bio :string(255)
# failed_attempts :integer default(0)
# locked_at :datetime
# unlock_token :string(255)
# username :string(255)
# can_create_group :boolean default(TRUE), not null
# can_create_team :boolean default(TRUE), not null
...
...
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