Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
26295001
Commit
26295001
authored
Jun 15, 2017
by
Timothy Andrew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move OAuth "remember me" javascript logic into a class.
parent
6bfc355e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
14 deletions
+33
-14
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+2
-0
app/assets/javascripts/oauth_remember_me.js
app/assets/javascripts/oauth_remember_me.js
+31
-0
app/views/devise/shared/_omniauth_box.html.haml
app/views/devise/shared/_omniauth_box.html.haml
+0
-14
No files found.
app/assets/javascripts/dispatcher.js
View file @
26295001
...
@@ -56,6 +56,7 @@ import GfmAutoComplete from './gfm_auto_complete';
...
@@ -56,6 +56,7 @@ import GfmAutoComplete from './gfm_auto_complete';
import
ShortcutsBlob
from
'
./shortcuts_blob
'
;
import
ShortcutsBlob
from
'
./shortcuts_blob
'
;
import
initSettingsPanels
from
'
./settings_panels
'
;
import
initSettingsPanels
from
'
./settings_panels
'
;
import
initExperimentalFlags
from
'
./experimental_flags
'
;
import
initExperimentalFlags
from
'
./experimental_flags
'
;
import
OAuthRememberMe
from
'
./oauth_remember_me
'
;
(
function
()
{
(
function
()
{
var
Dispatcher
;
var
Dispatcher
;
...
@@ -127,6 +128,7 @@ import initExperimentalFlags from './experimental_flags';
...
@@ -127,6 +128,7 @@ import initExperimentalFlags from './experimental_flags';
case
'
sessions:new
'
:
case
'
sessions:new
'
:
new
UsernameValidator
();
new
UsernameValidator
();
new
ActiveTabMemoizer
();
new
ActiveTabMemoizer
();
new
OAuthRememberMe
({
container
:
$
(
"
#remember_me
"
)
}).
bindEvents
();
break
;
break
;
case
'
projects:boards:show
'
:
case
'
projects:boards:show
'
:
case
'
projects:boards:index
'
:
case
'
projects:boards:index
'
:
...
...
app/assets/javascripts/oauth_remember_me.js
0 → 100644
View file @
26295001
/**
* OAuth-based login buttons have a separate "remember me" checkbox.
*
* Toggling this checkbox adds/removes a `remember_me` parameter to the
* login buttons' href, which is passed on to the omniauth callback.
**/
export
default
class
OAuthRememberMe
{
constructor
(
opts
=
{})
{
this
.
container
=
opts
.
container
||
''
;
this
.
loginLinkSelector
=
'
.oauth-login
'
;
}
bindEvents
()
{
this
.
container
.
on
(
'
click
'
,
this
.
toggleRememberMe
);
}
toggleRememberMe
(
event
)
{
var
rememberMe
=
$
(
event
.
target
).
is
(
"
:checked
"
);
$
(
'
.oauth-login
'
).
each
(
function
(
i
,
element
)
{
var
href
=
$
(
element
).
attr
(
'
href
'
);
if
(
rememberMe
)
{
$
(
element
).
attr
(
'
href
'
,
href
+
'
?remember_me=1
'
);
}
else
{
$
(
element
).
attr
(
'
href
'
,
href
.
replace
(
'
?remember_me=1
'
,
''
));
}
});
}
}
app/views/devise/shared/_omniauth_box.html.haml
View file @
26295001
...
@@ -10,17 +10,3 @@
...
@@ -10,17 +10,3 @@
%fieldset
%fieldset
=
check_box_tag
:remember_me
=
check_box_tag
:remember_me
=
label_tag
:remember_me
,
"Remember Me"
=
label_tag
:remember_me
,
"Remember Me"
:javascript
$
(
"
#remember_me
"
).
click
(
function
(
event
){
var
rememberMe
=
$
(
event
.
target
).
is
(
"
:checked
"
);
$
(
"
.oauth-login
"
).
each
(
function
(
i
,
element
)
{
var
href
=
$
(
element
).
attr
(
'
href
'
);
if
(
rememberMe
)
{
$
(
element
).
attr
(
'
href
'
,
href
+
'
?remember_me=1
'
);
}
else
{
$
(
element
).
attr
(
'
href
'
,
href
.
replace
(
'
?remember_me=1
'
,
''
));
}
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment