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
d2eb9bc8
Commit
d2eb9bc8
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
0754a442
Changes
3
Show 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 @
d2eb9bc8
...
...
@@ -59,6 +59,7 @@ import GfmAutoComplete from './gfm_auto_complete';
import
ShortcutsBlob
from
'
./shortcuts_blob
'
;
import
initSettingsPanels
from
'
./settings_panels
'
;
import
initExperimentalFlags
from
'
./experimental_flags
'
;
import
OAuthRememberMe
from
'
./oauth_remember_me
'
;
// EE-only
import
ApproversSelect
from
'
./approvers_select
'
;
...
...
@@ -134,6 +135,7 @@ import AuditLogs from './audit_logs';
case
'
sessions:new
'
:
new
UsernameValidator
();
new
ActiveTabMemoizer
();
new
OAuthRememberMe
({
container
:
$
(
"
#remember_me
"
)
}).
bindEvents
();
break
;
case
'
projects:boards:show
'
:
case
'
projects:boards:index
'
:
...
...
app/assets/javascripts/oauth_remember_me.js
0 → 100644
View file @
d2eb9bc8
/**
* 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 @
d2eb9bc8
...
...
@@ -10,17 +10,3 @@
%fieldset
=
check_box_tag
: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