update security handling for user namespace

This commit is contained in:
2012-11-22 15:47:28 +01:00
parent b9efc6e860
commit ef31958bd6
24 changed files with 634 additions and 64 deletions
+51
View File
@@ -0,0 +1,51 @@
// require 'twitter/bootstrap/bootstrap'
@import "twitter/bootstrap/variables";
@import "twitter/bootstrap/mixins";
@import "twitter/bootstrap/alerts";
@import "twitter/bootstrap/buttons";
@import "twitter/bootstrap/forms";
.devise {
br { display:none; }
// Copied from forms.less's legend
> h2, > h3 {
display: block;
width: 100%;
padding: 0;
margin-bottom: @baseLineHeight * 1.5;
font-size: @baseFontSize * 1.5;
line-height: @baseLineHeight * 2;
color: @grayDark;
border: 0;
border-bottom: 1px solid #eee;
}
> h2, >h3 {
margin-bottom: @baseLineHeight;
}
form {
// Base form styles
margin:0;
label[for=user_remember_me] { display: inline; }
input[type=submit] {
.btn-primary;
.btn-large;
margin:6px 0;
}
i { display: block; }
// Errors
#error_explanation {
h2 {
line-height: @baseLineHeight;
font-size: 14px;
.alert-error;
}
ul { margin-bottom: 0; }
.alert;
.alert-error;
}
.field_with_errors {
.control-group .error;
}
}
a:last-of-type:after { content: ''; }
a:after { content: '\0020\007c'; }
}
+119
View File
@@ -0,0 +1,119 @@
$baseline: 14px
$gray: #666
$wellBackground: #f5f5f5
$baseBorderRadius: 4px
$grayDark: #333
$baseLineHeight: 20px
@mixin transition($transitions...)
transition: $transitions
@mixin box-shadow($shadows...)
box-shadow: $shadows
@mixin border-radius($str)
border-radius: $str
@mixin opacity($str)
opacity: $str
@mixin well
min-height: 20px
padding: 19px
margin-bottom: 20px
background-color: $wellBackground
border: 1px solid darken($wellBackground, 7%)
+border-radius($baseBorderRadius)
+box-shadow(inset 0 1px 1px rgba(0,0,0,.05))
blockquote
border-color: #ddd
border-color: rgba(0,0,0,.15)
@mixin close
float: right
font-size: 20px
font-weight: bold
line-height: $baseLineHeight
color: black
text-shadow: 0 1px 0 rgba(255,255,255,1)
+opacity(.20)
&:hover
color: black
text-decoration: none
cursor: pointer
+opacity(.40)
.devise
form
// This is all copy/pasted. I can't get element-based rulesets to work
input[type=email]
display: inline-block
width: 210px
margin: 0
padding: 4px
font-size: 13px
line-height: $baseline
height: $baseline
color: $gray
border: 1px solid #ccc
+border-radius(3px)
// Focus states
input[type=email]
+transition(border linear .2s, box-shadow linear .2s)
+box-shadow(inset 0 1px 3px rgba(0,0,0,.1))
&:focus
outline: none
border-color: rgba(82,168,236,.8)
+box-shadow(inset 0 1px 3px rgba(0,0,0,.1), 0 0 8px rgba(82,168,236,.6))
margin-top: 20px
//.columns(7)
//.offset(4)
//.well
+well
h2
margin-left: 150px
margin-bottom: 15px
font-size: 20px
font-weight: normal
color: $grayDark
form
div
margin-bottom: baseline
a
margin: 0
&:after
content: '\0000a0'
&:before
content: none
br, i
display: none
input
margin-left: 20px
//* Oh, dear... *
label[for=user_remember_me]
padding: 0
position: relative
left: 130px
input[type=submit]
margin-left: 150px
//+btn
//+primary
a, h3, p
margin-left: 150px
p
a
margin: 0
&:before
content: none
a:before, p:before
content: '\002022\0000a0'
#error_explanation
//.alert-message.error
//.block-message
margin-left: 150px
text-shadow: none
h2
font-size: 13px
line-height: 18px
font-weight: bold
margin: 0 0 6px 0
h2, li
color: white
a
+close
//.alert-message.close
+14
View File
@@ -0,0 +1,14 @@
$ ->
$('.close').live 'click', (e) ->
e.preventDefault()
$(this).parent().hide()
$('.devise form div i').each ->
$this = $(this)
text = $this.text()
sibling = $this.prev('label')
a = $("<a>").text("*").attr('title', text)
a.prependTo(sibling)
devise_errors = $('.devise #error_explanation')
if devise_errors.length
close_link = $('<a>').addClass('close').attr('href', '#').text('\u00d7')
devise_errors.prepend(close_link)