devise

User Authentication with Grape and Devise

做~自己de王妃 提交于 2019-12-29 02:48:09
问题 I have difficulties to understand and also properly implement User Authentication in APIs. In other words, I have serious problem to understand the integration of Grape API with front-end frameworks such as Backbone.js, AngularJS or Ember.js. I'm trying to pivot all different approaches and read a lot about that, but Google returns me truly bad resources and it seems to me, like there is no really good article on this topic - Rails and User authentication with Devise and front-end frameworks

Devise and Strong Parameters

℡╲_俬逩灬. 提交于 2019-12-28 05:35:38
问题 I would like to know how to integrate both of this gems(devise + Strong Parameters), since strong params will likely be added to the rails core in 4.0 any help is welcome thanks 回答1: Update for devise 4.x class ApplicationController < ActionController::Base before_filter :configure_permitted_parameters, if: :devise_controller? protected def configure_permitted_parameters devise_parameter_sanitizer.permit(:sign_up, keys: [:username]) devise_parameter_sanitizer.permit(:sign_in, keys: [:username

“WARNING: Can't mass-assign protected attributes”

折月煮酒 提交于 2019-12-28 03:29:05
问题 I have used RESTful techniques to generate a model (in fact, I am using Devise gem, which does that for me), and I have added new fields called first_name and last_name to the model. Migration went fine. I added attr_accessor :first_name, :last_name to the model and expected it would just work. But when I try to mass-assign new instances with Doctor.create({:first_name=>"MyName"}) etc., I am getting errors saying I can't mass-assign protected attributes. I thought the whole point of using

Devise login with computed / manipulated username param

落花浮王杯 提交于 2019-12-25 18:41:12
问题 I'm trying to create a login using devise with a username that I've computed. As an example, let's assume we want to namespace our usernames - and I want to receive a username from the login form, and use namespaced_username to do the actual authentication. So in my User::SessionsController#create , I might have: def create params[:user][:namespaced_username] = "namespace/#{params[:user][:mobile_number]}" super end Even though devise is listening for namespaced_username (configured with

Rails 3 - retrieving last accessed action/controller from current controller

徘徊边缘 提交于 2019-12-25 17:46:28
问题 I need to be able to set my nav on the current page depending on which page the user was perviously on. e.g pageX => pageA(tab1selected) pageY => pageA(tab2selected) I know from reading you can use request.env["HTTP_REFERER"] but I read this doesnt always get return if the user has a firewall etc I am using devise in my app if that helps. Is there another method ? Thanks Alex 回答1: Though not a quick solution, it works: At the end each controller with view , call a method to set your store

Rails 3 - retrieving last accessed action/controller from current controller

允我心安 提交于 2019-12-25 17:46:05
问题 I need to be able to set my nav on the current page depending on which page the user was perviously on. e.g pageX => pageA(tab1selected) pageY => pageA(tab2selected) I know from reading you can use request.env["HTTP_REFERER"] but I read this doesnt always get return if the user has a firewall etc I am using devise in my app if that helps. Is there another method ? Thanks Alex 回答1: Though not a quick solution, it works: At the end each controller with view , call a method to set your store

Devise destroy_user_session_path doesn't work

谁都会走 提交于 2019-12-25 13:27:26
问题 In my ruby on rails application I've a problem for the user logout with devise I've this navbar: <% if current_user %> <nav class="top-bar" data-topbar role="navigation"> <ul class="title-area"> <li class="name"> <h1><%= link_to 'Prova CMS', articles_path %></h1> </li> <li class="toggle-topbar menu-icon"><a href="#"></a></li> </ul> <section class="top-bar-section"> <ul class="right"> <li><%=link_to 'Gestisci Articoli', articles_path %></li> <li><%=link_to 'Gestisci Categorie', categories_path

Devise destroy_user_session_path doesn't work

允我心安 提交于 2019-12-25 13:27:05
问题 In my ruby on rails application I've a problem for the user logout with devise I've this navbar: <% if current_user %> <nav class="top-bar" data-topbar role="navigation"> <ul class="title-area"> <li class="name"> <h1><%= link_to 'Prova CMS', articles_path %></h1> </li> <li class="toggle-topbar menu-icon"><a href="#"></a></li> </ul> <section class="top-bar-section"> <ul class="right"> <li><%=link_to 'Gestisci Articoli', articles_path %></li> <li><%=link_to 'Gestisci Categorie', categories_path

Heroku Application Error Occur

扶醉桌前 提交于 2019-12-25 09:43:15
问题 Heroku Application error I don't understand why this will be happen.Can anyone tell me why this will be happening...? Application Error An error occurred in the application and your page could not be served. Please try again in a few moments. If you are the application owner, check your logs for details. Logs 2014-01-15T09:12:41.883290+00:00 app[web.1]: from /app/config/environment.rb:5:in `<top (required)>' 2014-01-15T09:12:41.883290+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems

press back button on correct sign in after incorrect sign in takes to the signin page

a 夏天 提交于 2019-12-25 08:48:26
问题 I am using devise, and I m facing a interesting use case. Being at the page: http://localhost:3000/users/sign_in , if I enter the correct login id and password, I log into the site. Now, if I press back button, it says u are already logged in. but Being at the page: http://localhost:3000/users/sign_in , I enter wrong login id and password, it gives error, and again remains at this page. I enter correct login id and password, I log into the site. Now, if I press back button, it takes to the