Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just fixed paths to devise unlocks view #1933

Merged
merged 1 commit into from
Mar 4, 2013
Merged

Just fixed paths to devise unlocks view #1933

merged 1 commit into from
Mar 4, 2013

Conversation

Bishop
Copy link
Contributor

@Bishop Bishop commented Feb 21, 2013

No description provided.

@seanlinsley
Copy link
Contributor

I've never used locks & unlocks with Devise...

  • What exactly does this fix?
  • What's the default configuration for Devise unlocks in relation to Active Admin?

Also, could you add a newline to the bottom of the view template file?

@Bishop
Copy link
Contributor Author

Bishop commented Feb 21, 2013

https://github.com/plataformatec/devise:

Lockable: locks an account after a specified number of failed sign-in attempts (default 20). Can unlock via email or after a specified time period.

It is one of features, that disabled by default. It should be enabled by hand (both in model and in migration). From default devise migration:

      ## Confirmable
      # t.string   :confirmation_token
      # t.datetime :confirmed_at
      # t.datetime :confirmation_sent_at
      # t.string   :unconfirmed_email # Only if using reconfirmable

      ## Lockable
      # t.integer  :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
      # t.string   :unlock_token # Only if unlock strategy is :email or :both
      # t.datetime :locked_at

      ## Token authenticatable
      # t.string :authentication_token

I think it is useful feature for admin interface. And I found corresponding view in ActiveAdmin source. Link to this page shows in /app/views/active_admin/devise/shared/_links.erb automaticaly. But this view doesn't renders. I have changed this view like other active_admin/devise views and I have added controller for devise renders this view.

/app/views/active_admin/devise/shared/_links.erb :

<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
  <%= link_to t('active_admin.devise.links.resend_confirmation_instructions'), new_confirmation_path(resource_name) %><br />
<% end -%>

<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
  <%= link_to t('active_admin.devise.links.resend_unlock_instructions'), new_unlock_path(resource_name) %><br />
<% end -%>

There is confirmable logic also. I don't know, do you need it in active_admin.

@seanlinsley
Copy link
Contributor

BTW, you can reforge your initial commit to include that newline (keeps AA's commit history clean)

git reset HEAD~1 # undoes the newline commit, putting its changes in your working directory
git add app/views/active_admin/devise/unlocks/new.html.erb
git diff # just to confirm
git commit --amend # rewrites your original commit, including any changes that have been staged
git push origin --force

@Bishop
Copy link
Contributor Author

Bishop commented Feb 25, 2013

Done.

macfanatic added a commit that referenced this pull request Mar 4, 2013
Just fixed paths to devise unlocks view
@macfanatic macfanatic merged commit 96f4396 into activeadmin:master Mar 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants