gitlab-org--gitlab-foss/app/views/devise/shared/_omniauth_box.html.haml
Timothy Andrew 633793cf47 Implement "remember me" for OAuth-based login.
- Pass a `remember_me` query parameter along with the initial OAuth request, and
  pick this parameter up during the omniauth callback from
  request.env['omniauth.params']`.

- For 2FA-based login, copy the `remember_me` param from `omniauth.params` to
  `params`, which the 2FA process will pick up.

- For non-2FA-based login, simply call the `remember_me` devise method to set
  the session cookie.
2017-07-06 06:29:58 +00:00

26 lines
874 B
Text

.omniauth-container
%p
%span.light
Sign in with  
- providers = enabled_button_based_providers
- providers.each do |provider|
%span.light
- has_icon = provider_has_icon?(provider)
= link_to provider_image_tag(provider), omniauth_authorize_path(:user, provider), method: :post, class: 'oauth-login' + (has_icon ? ' oauth-image-link' : ' btn')
%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', ''));
}
});
});