allow setting the storage
This commit is contained in:
parent
21af8176a1
commit
4a443aee41
|
@ -17,8 +17,12 @@ module Travis
|
||||||
|
|
||||||
def info_for(env)
|
def info_for(env)
|
||||||
return unless env['REQUEST_METHOD'] == 'POST'
|
return unless env['REQUEST_METHOD'] == 'POST'
|
||||||
info = Rack::Request.new(env).params.values_at('token', 'user')
|
request = Rack::Request.new(env)
|
||||||
info if info.first =~ /\A[a-zA-Z\-_\d]+\Z/
|
token, user, storage = request.params.values_at('token', 'user', 'storage')
|
||||||
|
if token =~ /\A[a-zA-Z\-_\d]+\Z/
|
||||||
|
storage = 'sessionStorage' if storage.to_s.empty?
|
||||||
|
[storage, token, user, request.fullpath]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -26,7 +30,8 @@ end
|
||||||
|
|
||||||
__END__
|
__END__
|
||||||
<script>
|
<script>
|
||||||
sessionStorage.setItem('travis.token', %p);
|
var storage = %s;
|
||||||
sessionStorage.setItem('travis.user', %p);
|
storage.setItem('travis.token', %p);
|
||||||
window.location = '/';
|
storage.setItem('travis.user', %p);
|
||||||
|
window.location = %p;
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user