warden

OSChina 周六乱弹 —— 那你爸爸一定是哥布林杀手

我们两清 提交于 2020-10-02 20:02:25
Osc乱弹歌单(2020)请戳( 这里 ) 【今日歌曲】 @ 薛定谔的兄弟 :分享洛神有语创建的歌单「我喜欢的音乐」: 《那一刻,我望见冬日暖阳洒在看雪景的你的发梢》- TAVOS / N.Warden 手机党少年们想听歌,请使劲儿戳( 这里 ) @ k== :早上没吃饱,有谁给我来点鸡汤呗 好呀…… 就昨天乱弹写完, 文章最后看片栏目的那个视频, 看了好几遍, 今天看了一个跟那个视频意思差不多的一段话, 谈了几年的爱情被割舍, @ 开源中国首席发型师 :分手了,再也不怕绿了 你都明白了什么? 分都分了, 还不如说点明白的, @ 激萌路小叔 :如何从失恋的悲伤中快速恢复? 看看那些比你更难过的, 连恋爱都不配有的, 还好分手了, 不然等着做选择题吧。 @ 一个柒 :女朋友问:为了基因更好我选择购买精子,你可以接受吗? 确定是基因么? @ 梅馨扰梦 :小孩的智商大部分是继承母亲的!所以为了后代你应该和你女朋友商量找个学历高智商高的女孩来代孕才是最好的。 “那你爸爸一定是哥布林杀手。” 购买的这个, 是合格产品么? 不怕被315打假么。 @ tomasan :汉堡王哈哈哈哈哈哈哈哈,伊利蒙牛安心了,亲儿子还是好,哈哈哈哈哈哈哈哈哈哈 “说明汉堡王是真肉,肯德基的牛肉堡我家猫都不吃。” 感觉日常生活基本恢复了, 包括电影也快能看了。 @ theLovelyBugfly

Devise warden error thrown for authenticate_user in functional Rails test

旧巷老猫 提交于 2020-01-20 03:32:29
问题 I have a resource where the new action requires a user to be logged in to view. If a user tries to create a new resource without being logged in, they are redirected (302'd) to the login page. My functional test looks like this: test "should not get new unless logged in" do get :new assert_response :redirect end The stacktrace looks something like this: ArgumentError: uncaught throw :warden /.../gems/warden-1.1.1/lib/warden/proxy.rb:114:in `throw' /.../gems/ruby-1.9.2-p318/gems/warden-1.1.1

Ruby on Rails Devise code after login

我的未来我决定 提交于 2020-01-10 01:35:34
问题 I have an RoR app using Devise for logins. There is some code that is executed when a new User record is created, by being put in the user.rb file as an after_create call/macro/whatever. I need to make this code run after each login, instead of running on new user creation. With some Googling, it seems that one option is to place Warden callbacks in the devise.rb code. My questions are: Is this right, and/or is there a better way to do this? If this is the right approach ... Should the Warden

Set user time zone dynamically with devise

时光毁灭记忆、已成空白 提交于 2020-01-03 18:04:34
问题 I've built a rails app that helps parents keep track of their infants’ sleep. For it to work properly I've had to support different time zones. To avoid annoying the user with time zones, I've created a little javascript that adds a hidden field to the login form, including the timezone offset. Here's the code var timeZoneField = $("input[name='user_tz_offset']"); if (timeZoneField.length) { var browserDate = new Date(); var timeZoneOffsetSeconds = (browserDate.getTimezoneOffset() * 60) * -1;

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

Stubbing Warden on Controller Tests

删除回忆录丶 提交于 2019-12-19 08:33:07
问题 I'm having an issue with testing my controllers and using Warden. All examples point at stubbing request.env['warden'] . This causes issues in my controllers when I call env['warden'] , which then returns nil . For a crude example, using this: request.env['warden'] = double(Warden, :authenticate => nil, :authenticate! => nil, :authenticated? => false) And a simple before filter like this: before_filter do redirect_to new_user_session_url unless env['warden'].authenticated? end I get a nil . I

Stubbing Warden on Controller Tests

自闭症网瘾萝莉.ら 提交于 2019-12-19 08:32:14
问题 I'm having an issue with testing my controllers and using Warden. All examples point at stubbing request.env['warden'] . This causes issues in my controllers when I call env['warden'] , which then returns nil . For a crude example, using this: request.env['warden'] = double(Warden, :authenticate => nil, :authenticate! => nil, :authenticated? => false) And a simple before filter like this: before_filter do redirect_to new_user_session_url unless env['warden'].authenticated? end I get a nil . I

Sinatra Warden with existing Ruby on Rails application that uses Devise

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-18 17:08:17
问题 I am trying to split my current Ruby on Rails 3 web-application and it's web-services (API). My web-application is running on Heroku and implements API as a namespaced route within my application. For example /events returns a HTML page and /api/v1/events returns a JSON data. According to some best practices, I want to split those into two different applications. I have chosen Sinatra to implement the API application. It works now for simple requests where authentication is not required. My

Active Admin authentication conflicting with User authentication

烈酒焚心 提交于 2019-12-18 15:09:01
问题 Active Admin is a gem used for having an admin dashboard in your application. It uses Devise for logging in users and creates a separate admin_user model for the admins. My application already uses devise and has its users as the user model. Ever since I started using the active admin gem, in my routes file the following line keeps resolving to home#index and not users#dashboard even when my user is logged in. This used to work fine earlier where logged in users were taken to users#dashboard

Configuring Warden for use in RSpec controller specs

﹥>﹥吖頭↗ 提交于 2019-12-17 09:39:57
问题 I was able to use Devise's sign_in method to log in a user in my controller specs. But now that I'm removing Devise from my application, I'm not quite sure how to get similar functionality working with just Warden on its own. How should I go about setting up spec/spec_helper.rb and related spec/support/*.rb files to get Warden running within controller specs sufficiently? I've tried setting up a file at spec/support/warden.rb with these contents: RSpec.configure do |config| config.include